about summary refs log tree commit diff
path: root/library/std/src/sys/stdio/unix.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-18 10:09:29 +0100
committerGitHub <noreply@github.com>2025-03-18 10:09:29 +0100
commit800b8fbe39f28e4bd028beedf136f13721d218b8 (patch)
tree1bc8e1a2599221522e19ab8a408f787d7d4b8652 /library/std/src/sys/stdio/unix.rs
parent42293e3c68e93c9518211a56f9bfa888508888ab (diff)
parentc5fc1931a05f48fe3b4adf213ad3fcefb4e4434b (diff)
downloadrust-800b8fbe39f28e4bd028beedf136f13721d218b8.tar.gz
rust-800b8fbe39f28e4bd028beedf136f13721d218b8.zip
Rollup merge of #138301 - thaliaarchi:io-optional-methods/hermit, r=tgross35
Implement `read_buf` for Hermit

Following https://github.com/hermit-os/kernel/pull/1606, it is now safe to implement `Read::read_buf` for file descriptors on Hermit.

cc ```@mkroening```
Diffstat (limited to 'library/std/src/sys/stdio/unix.rs')
-rw-r--r--library/std/src/sys/stdio/unix.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/library/std/src/sys/stdio/unix.rs b/library/std/src/sys/stdio/unix.rs
index 8d133857c59..08a06e0da9f 100644
--- a/library/std/src/sys/stdio/unix.rs
+++ b/library/std/src/sys/stdio/unix.rs
@@ -3,9 +3,7 @@ use hermit_abi::{EBADF, STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO};
 #[cfg(target_family = "unix")]
 use libc::{EBADF, STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO};
 
-#[cfg(target_family = "unix")]
-use crate::io::BorrowedCursor;
-use crate::io::{self, IoSlice, IoSliceMut};
+use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
 use crate::mem::ManuallyDrop;
 #[cfg(target_os = "hermit")]
 use crate::os::hermit::io::FromRawFd;
@@ -28,7 +26,6 @@ impl io::Read for Stdin {
         unsafe { ManuallyDrop::new(FileDesc::from_raw_fd(STDIN_FILENO)).read(buf) }
     }
 
-    #[cfg(not(target_os = "hermit"))]
     fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> io::Result<()> {
         unsafe { ManuallyDrop::new(FileDesc::from_raw_fd(STDIN_FILENO)).read_buf(buf) }
     }