From 5eb88fa5c72d0f9b5abe106881f2c5ffba9b073d Mon Sep 17 00:00:00 2001 From: The8472 Date: Sat, 8 Aug 2020 01:30:03 +0200 Subject: [PATCH] hide unused exports on other platforms --- library/std/src/io/mod.rs | 4 +--- library/std/src/io/stdio.rs | 2 ++ library/std/src/sys/unix/fs.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index 0529b42347e..cc0e1172a53 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -283,10 +283,8 @@ pub use self::stdio::{set_panic, set_print}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::util::{empty, repeat, sink, Empty, Repeat, Sink}; -pub(crate) use self::copy::generic_copy; - mod buffered; -mod copy; +pub(crate) mod copy; mod cursor; mod error; mod impls; diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs index 47ff13f5298..8a69e9ccd55 100644 --- a/library/std/src/io/stdio.rs +++ b/library/std/src/io/stdio.rs @@ -409,6 +409,8 @@ impl Read for Stdin { } } +// only used by platform-dependent io::copy specializations, i.e. unused on some platforms +#[cfg(any(target_os = "linux", target_os = "android"))] impl StdinLock<'_> { pub(crate) fn as_mut_buf(&mut self) -> &mut BufReader { &mut self.inner diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index 012e4a16b9f..b106eb0a5b6 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -1276,7 +1276,7 @@ pub(crate) fn copy_regular_files( // - copy_file_range is disallowed, for example by seccomp (EPERM) // - copy_file_range cannot be used with pipes or device nodes (EINVAL) assert_eq!(written, 0); - return io::generic_copy(reader, writer); + return io::copy::generic_copy(reader, writer); } _ => return Err(err), } @@ -1328,7 +1328,7 @@ pub(crate) fn sendfile_splice( // Try fallback io::copy if splice/sendfile do not support this particular // file descritor (EINVAL) assert_eq!(written, 0); - return io::generic_copy(reader, writer); + return io::copy::generic_copy(reader, writer); } _ => return Err(err), }