Skip to content

Commit

Permalink
avoid the usage of libc during the creation of documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed Feb 24, 2023
1 parent 90162a7 commit af8ee64
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions library/std/src/os/fd/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ use crate::os::unix::io::OwnedFd;
use crate::os::wasi::io::OwnedFd;
use crate::sys_common::{AsInner, IntoInner};
#[cfg(target_os = "hermit")]
use hermit_abi::{STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO};
#[cfg(not(target_os = "hermit"))]
use libc::{STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO};
use hermit_abi as libc;

/// Raw file descriptors.
#[rustc_allowed_through_unstable_modules]
Expand Down Expand Up @@ -189,47 +187,47 @@ impl IntoRawFd for fs::File {
impl AsRawFd for io::Stdin {
#[inline]
fn as_raw_fd(&self) -> RawFd {
STDIN_FILENO
libc::STDIN_FILENO
}
}

#[stable(feature = "asraw_stdio", since = "1.21.0")]
impl AsRawFd for io::Stdout {
#[inline]
fn as_raw_fd(&self) -> RawFd {
STDOUT_FILENO
libc::STDOUT_FILENO
}
}

#[stable(feature = "asraw_stdio", since = "1.21.0")]
impl AsRawFd for io::Stderr {
#[inline]
fn as_raw_fd(&self) -> RawFd {
STDERR_FILENO
libc::STDERR_FILENO
}
}

#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
impl<'a> AsRawFd for io::StdinLock<'a> {
#[inline]
fn as_raw_fd(&self) -> RawFd {
STDIN_FILENO
libc::STDIN_FILENO
}
}

#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
impl<'a> AsRawFd for io::StdoutLock<'a> {
#[inline]
fn as_raw_fd(&self) -> RawFd {
STDOUT_FILENO
libc::STDOUT_FILENO
}
}

#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
impl<'a> AsRawFd for io::StderrLock<'a> {
#[inline]
fn as_raw_fd(&self) -> RawFd {
STDERR_FILENO
libc::STDERR_FILENO
}
}

Expand Down

0 comments on commit af8ee64

Please sign in to comment.