Skip to content

Commit af8ee64

Browse files
committed
avoid the usage of libc during the creation of documentation
1 parent 90162a7 commit af8ee64

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

library/std/src/os/fd/raw.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ use crate::os::unix::io::OwnedFd;
1616
use crate::os::wasi::io::OwnedFd;
1717
use crate::sys_common::{AsInner, IntoInner};
1818
#[cfg(target_os = "hermit")]
19-
use hermit_abi::{STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO};
20-
#[cfg(not(target_os = "hermit"))]
21-
use libc::{STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO};
19+
use hermit_abi as libc;
2220

2321
/// Raw file descriptors.
2422
#[rustc_allowed_through_unstable_modules]
@@ -189,47 +187,47 @@ impl IntoRawFd for fs::File {
189187
impl AsRawFd for io::Stdin {
190188
#[inline]
191189
fn as_raw_fd(&self) -> RawFd {
192-
STDIN_FILENO
190+
libc::STDIN_FILENO
193191
}
194192
}
195193

196194
#[stable(feature = "asraw_stdio", since = "1.21.0")]
197195
impl AsRawFd for io::Stdout {
198196
#[inline]
199197
fn as_raw_fd(&self) -> RawFd {
200-
STDOUT_FILENO
198+
libc::STDOUT_FILENO
201199
}
202200
}
203201

204202
#[stable(feature = "asraw_stdio", since = "1.21.0")]
205203
impl AsRawFd for io::Stderr {
206204
#[inline]
207205
fn as_raw_fd(&self) -> RawFd {
208-
STDERR_FILENO
206+
libc::STDERR_FILENO
209207
}
210208
}
211209

212210
#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
213211
impl<'a> AsRawFd for io::StdinLock<'a> {
214212
#[inline]
215213
fn as_raw_fd(&self) -> RawFd {
216-
STDIN_FILENO
214+
libc::STDIN_FILENO
217215
}
218216
}
219217

220218
#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
221219
impl<'a> AsRawFd for io::StdoutLock<'a> {
222220
#[inline]
223221
fn as_raw_fd(&self) -> RawFd {
224-
STDOUT_FILENO
222+
libc::STDOUT_FILENO
225223
}
226224
}
227225

228226
#[stable(feature = "asraw_stdio_locks", since = "1.35.0")]
229227
impl<'a> AsRawFd for io::StderrLock<'a> {
230228
#[inline]
231229
fn as_raw_fd(&self) -> RawFd {
232-
STDERR_FILENO
230+
libc::STDERR_FILENO
233231
}
234232
}
235233

0 commit comments

Comments
 (0)