From e884ec7547954823a5df80b532dda5272b01afa6 Mon Sep 17 00:00:00 2001 From: Matt Wilkinson Date: Sun, 21 Nov 2021 21:40:35 -0500 Subject: [PATCH 1/7] add is_terminal trait and implementations --- library/std/src/io/mod.rs | 14 +++- library/std/src/io/stdio.rs | 53 +++++++++++++ library/std/src/lib.rs | 2 + library/std/src/sys/hermit/stdio.rs | 20 +++++ library/std/src/sys/unix/io.rs | 23 +++++- library/std/src/sys/windows/c.rs | 6 ++ library/std/src/sys/windows/io.rs | 118 ++++++++++++++++++++++++++++ library/test/src/cli.rs | 4 +- library/test/src/helpers/isatty.rs | 32 -------- library/test/src/helpers/mod.rs | 1 - library/test/src/lib.rs | 8 +- 11 files changed, 243 insertions(+), 38 deletions(-) delete mode 100644 library/test/src/helpers/isatty.rs diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index cd2197fca350e..baef80d1beb41 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -266,6 +266,14 @@ pub use self::buffered::WriterPanicked; #[unstable(feature = "internal_output_capture", issue = "none")] #[doc(no_inline, hidden)] pub use self::stdio::set_output_capture; +#[unstable(feature = "is_terminal", issue = "80937")] +pub use self::stdio::IsTerminal; +#[stable(feature = "rust1", since = "1.0.0")] +pub use self::stdio::{stderr, stdin, stdout, Stderr, Stdin, Stdout}; +#[unstable(feature = "stdio_locked", issue = "86845")] +pub use self::stdio::{stderr_locked, stdin_locked, stdout_locked}; +#[stable(feature = "rust1", since = "1.0.0")] +pub use self::stdio::{StderrLock, StdinLock, StdoutLock}; #[unstable(feature = "print_internals", issue = "none")] pub use self::stdio::{_eprint, _print}; #[stable(feature = "rust1", since = "1.0.0")] @@ -2379,7 +2387,11 @@ impl BufRead for Chain { } fn consume(&mut self, amt: usize) { - if !self.done_first { self.first.consume(amt) } else { self.second.consume(amt) } + if !self.done_first { + self.first.consume(amt) + } else { + self.second.consume(amt) + } } } diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs index ac6d41e13b009..e36dcbfe52168 100644 --- a/library/std/src/io/stdio.rs +++ b/library/std/src/io/stdio.rs @@ -1018,6 +1018,59 @@ where } } +/// Trait to determine if stdio stream (Stdin, Stdout, Stderr) is a terminal/tty. +#[unstable(feature = "is_terminal", issue = "80937")] +pub trait IsTerminal { + /// returns true if stdio stream (Stdin, Stdout, Stderr) is a terminal/tty. + fn is_terminal() -> bool; +} + +cfg_if::cfg_if! { + if #[cfg(any(unix, windows, hermit))] { + #[unstable(feature = "is_terminal", issue = "80937")] + impl IsTerminal for Stdin { + fn is_terminal() -> bool { + stdio::Stdin::is_terminal() + } + } + + #[unstable(feature = "is_terminal", issue = "80937")] + impl IsTerminal for Stdout { + fn is_terminal() -> bool { + stdio::Stdout::is_terminal() + } + } + + #[unstable(feature = "is_terminal", issue = "80937")] + impl IsTerminal for Stderr { + fn is_terminal() -> bool { + stdio::Stderr::is_terminal() + } + } + } else { + #[unstable(feature = "is_terminal", issue = "80937")] + impl IsTerminal for Stdin { + fn is_terminal() -> bool { + false + } + } + + #[unstable(feature = "is_terminal", issue = "80937")] + impl IsTerminal for Stdout { + fn is_terminal() -> bool { + false + } + } + + #[unstable(feature = "is_terminal", issue = "80937")] + impl IsTerminal for Stderr { + fn is_terminal() -> bool { + false + } + } + } +} + #[unstable( feature = "print_internals", reason = "implementation detail which may disappear or be replaced at any time", diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index a464f2d4c7431..480532e0fdb3e 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -279,6 +279,8 @@ #![feature(hashmap_internals)] #![feature(int_error_internals)] #![feature(intra_doc_pointers)] +#![feature(is_terminal)] +#![feature(iter_zip)] #![feature(lang_items)] #![feature(linkage)] #![feature(log_syntax)] diff --git a/library/std/src/sys/hermit/stdio.rs b/library/std/src/sys/hermit/stdio.rs index 514de1df6f9c3..9c0098d96ec4c 100644 --- a/library/std/src/sys/hermit/stdio.rs +++ b/library/std/src/sys/hermit/stdio.rs @@ -118,3 +118,23 @@ pub fn is_ebadf(_err: &io::Error) -> bool { pub fn panic_output() -> Option { Some(Stderr::new()) } + +#[unstable(feature = "is_terminal", issue = "80937")] +impl io::IsTerminal for sys::stdio::Stdin { + fn is_terminal() -> bool { + abi::isatty(abi::STDIN_FILENO) + } +} + +#[unstable(feature = "is_terminal", issue = "80937")] +impl io::IsTerminal for sys::stdio::Stdout { + fn is_terminal() -> bool { + abi::isatty(abi::STDOUT_FILENO) + } +} +#[unstable(feature = "is_terminal", issue = "80937")] +impl io::IsTerminal for sys::stdio::Stderr { + fn is_terminal() -> bool { + abi::isatty(abi::STDERR_FILENO) + } +} diff --git a/library/std/src/sys/unix/io.rs b/library/std/src/sys/unix/io.rs index deb5ee76bd035..fa276a623b230 100644 --- a/library/std/src/sys/unix/io.rs +++ b/library/std/src/sys/unix/io.rs @@ -1,6 +1,7 @@ +use crate::io; use crate::marker::PhantomData; use crate::slice; - +use crate::sys; use libc::{c_void, iovec}; #[derive(Copy, Clone)] @@ -74,3 +75,23 @@ impl<'a> IoSliceMut<'a> { unsafe { slice::from_raw_parts_mut(self.vec.iov_base as *mut u8, self.vec.iov_len) } } } + +#[unstable(feature = "is_terminal", issue = "80937")] +impl io::IsTerminal for sys::stdio::Stdin { + fn is_terminal() -> bool { + unsafe { libc::isatty(libc::STDIN_FILENO) != 0 } + } +} + +#[unstable(feature = "is_terminal", issue = "80937")] +impl io::IsTerminal for sys::stdio::Stdout { + fn is_terminal() -> bool { + unsafe { libc::isatty(libc::STDOUT_FILENO) != 0 } + } +} +#[unstable(feature = "is_terminal", issue = "80937")] +impl io::IsTerminal for sys::stdio::Stderr { + fn is_terminal() -> bool { + unsafe { libc::isatty(libc::STDERR_FILENO) != 0 } + } +} diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs index 9b61b2476d5bb..5f961a508ba3f 100644 --- a/library/std/src/sys/windows/c.rs +++ b/library/std/src/sys/windows/c.rs @@ -484,6 +484,12 @@ pub struct SYMBOLIC_LINK_REPARSE_BUFFER { pub PathBuffer: WCHAR, } +#[repr(C)] +pub struct FILE_NAME_INFO { + FileNameLength: DWORD, + FileName: [WCHAR; 1], +} + #[repr(C)] pub struct MOUNT_POINT_REPARSE_BUFFER { pub SubstituteNameOffset: c_ushort, diff --git a/library/std/src/sys/windows/io.rs b/library/std/src/sys/windows/io.rs index fb06df1f80cda..78750b3cb6cc0 100644 --- a/library/std/src/sys/windows/io.rs +++ b/library/std/src/sys/windows/io.rs @@ -1,3 +1,4 @@ +use crate::io; use crate::marker::PhantomData; use crate::slice; use crate::sys::c; @@ -78,3 +79,120 @@ impl<'a> IoSliceMut<'a> { unsafe { slice::from_raw_parts_mut(self.vec.buf as *mut u8, self.vec.len as usize) } } } + +#[unstable(feature = "is_terminal", issue = "80937")] +impl io::IsTerminal for sys::stdio::Stdin { + fn is_terminal() -> bool { + let fd = c::STD_INPUT_HANDLE; + let others = [c::STD_ERROR_HANDLE, c::STD_OUTPUT_HANDLE]; + + if unsafe { console_on_any(&[fd]) } { + // False positives aren't possible. If we got a console then + // we definitely have a tty on stdin. + return true; + } + + // At this point, we *could* have a false negative. We can determine that + // this is true negative if we can detect the presence of a console on + // any of the other streams. If another stream has a console, then we know + // we're in a Windows console and can therefore trust the negative. + if unsafe { console_on_any(&others) } { + return false; + } + + // Otherwise, we fall back to a very strange msys hack to see if we can + // sneakily detect the presence of a tty. + unsafe { msys_tty_on(fd) } + } +} + +#[unstable(feature = "is_terminal", issue = "80937")] +impl io::IsTerminal for sys::stdio::Stdout { + fn is_terminal() -> bool { + let fd = c::STD_OUTPUT_HANDLE; + let others = [c::STD_INPUT_HANDLE, c::STD_ERROR_HANDLE]; + + if unsafe { console_on_any(&[fd]) } { + // False positives aren't possible. If we got a console then + // we definitely have a tty on stdin. + return true; + } + + // At this point, we *could* have a false negative. We can determine that + // this is true negative if we can detect the presence of a console on + // any of the other streams. If another stream has a console, then we know + // we're in a Windows console and can therefore trust the negative. + if unsafe { console_on_any(&others) } { + return false; + } + + // Otherwise, we fall back to a very strange msys hack to see if we can + // sneakily detect the presence of a tty. + unsafe { msys_tty_on(fd) } + } +} + +#[unstable(feature = "is_terminal", issue = "80937")] +impl io::IsTerminal for sys::stdio::Stderr { + fn is_terminal() -> bool { + let fd = c::STD_ERROR_HANDLE; + let others = [c::STD_INPUT_HANDLE, c::STD_OUTPUT_HANDLE]; + + if unsafe { console_on_any(&[fd]) } { + // False positives aren't possible. If we got a console then + // we definitely have a tty on stdin. + return true; + } + + // At this point, we *could* have a false negative. We can determine that + // this is true negative if we can detect the presence of a console on + // any of the other streams. If another stream has a console, then we know + // we're in a Windows console and can therefore trust the negative. + if unsafe { console_on_any(&others) } { + return false; + } + + // Otherwise, we fall back to a very strange msys hack to see if we can + // sneakily detect the presence of a tty. + unsafe { msys_tty_on(fd) } + } +} + +#[unstable(feature = "is_terminal", issue = "80937")] +unsafe fn console_on_any(fds: &[c::DWORD]) -> bool { + for &fd in fds { + let mut out = 0; + let handle = c::GetStdHandle(fd); + if c::GetConsoleMode(handle, &mut out) != 0 { + return true; + } + } + false +} +#[unstable(feature = "is_terminal", issue = "80937")] +unsafe fn msys_tty_on(fd: c::DWORD) -> bool { + let size = std::mem::size_of::(); + let mut name_info_bytes = vec![0u8; size + c::MAX_PATH * std::mem::size_of::()]; + let res = c::GetFileInformationByHandleEx( + c::GetStdHandle(fd), + c::FileNameInfo, + &mut *name_info_bytes as *mut _ as *mut c::c_void, + name_info_bytes.len() as u32, + ); + if res == 0 { + return false; + } + let name_info: &c::FILE_NAME_INFO = &*(name_info_bytes.as_ptr() as *const c::FILE_NAME_INFO); + let s = std::slice::from_raw_parts( + name_info.FileName.as_ptr(), + name_info.FileNameLength as usize / 2, + ); + let name = String::from_utf16_lossy(s); + // This checks whether 'pty' exists in the file name, which indicates that + // a pseudo-terminal is attached. To mitigate against false positives + // (e.g., an actual file name that contains 'pty'), we also require that + // either the strings 'msys-' or 'cygwin-' are in the file name as well.) + let is_msys = name.contains("msys-") || name.contains("cygwin-"); + let is_pty = name.contains("-pty"); + is_msys && is_pty +} diff --git a/library/test/src/cli.rs b/library/test/src/cli.rs index 000f5fa3f5860..c0bdb8b8c9ad1 100644 --- a/library/test/src/cli.rs +++ b/library/test/src/cli.rs @@ -3,9 +3,9 @@ use std::env; use std::path::PathBuf; -use super::helpers::isatty; use super::options::{ColorConfig, Options, OutputFormat, RunIgnored}; use super::time::TestTimeOptions; +use std::io::{IsTerminal, Stdout}; #[derive(Debug)] pub struct TestOpts { @@ -32,7 +32,7 @@ pub struct TestOpts { impl TestOpts { pub fn use_color(&self) -> bool { match self.color { - ColorConfig::AutoColor => !self.nocapture && isatty::stdout_isatty(), + ColorConfig::AutoColor => !self.nocapture && Stdout::is_terminal(), ColorConfig::AlwaysColor => true, ColorConfig::NeverColor => false, } diff --git a/library/test/src/helpers/isatty.rs b/library/test/src/helpers/isatty.rs deleted file mode 100644 index 874ecc3764572..0000000000000 --- a/library/test/src/helpers/isatty.rs +++ /dev/null @@ -1,32 +0,0 @@ -//! Helper module which provides a function to test -//! if stdout is a tty. - -cfg_if::cfg_if! { - if #[cfg(unix)] { - pub fn stdout_isatty() -> bool { - unsafe { libc::isatty(libc::STDOUT_FILENO) != 0 } - } - } else if #[cfg(windows)] { - pub fn stdout_isatty() -> bool { - type DWORD = u32; - type BOOL = i32; - type HANDLE = *mut u8; - type LPDWORD = *mut u32; - const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD; - extern "system" { - fn GetStdHandle(which: DWORD) -> HANDLE; - fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: LPDWORD) -> BOOL; - } - unsafe { - let handle = GetStdHandle(STD_OUTPUT_HANDLE); - let mut out = 0; - GetConsoleMode(handle, &mut out) != 0 - } - } - } else { - // FIXME: Implement isatty on SGX - pub fn stdout_isatty() -> bool { - false - } - } -} diff --git a/library/test/src/helpers/mod.rs b/library/test/src/helpers/mod.rs index 049cadf86a6d0..6f366a911e8cd 100644 --- a/library/test/src/helpers/mod.rs +++ b/library/test/src/helpers/mod.rs @@ -3,6 +3,5 @@ pub mod concurrency; pub mod exit_code; -pub mod isatty; pub mod metrics; pub mod shuffle; diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs index 088e3a23ea4d9..d8aeb7318089f 100644 --- a/library/test/src/lib.rs +++ b/library/test/src/lib.rs @@ -18,6 +18,8 @@ #![feature(nll)] #![feature(bench_black_box)] #![feature(internal_output_capture)] +#![feature(is_terminal)] +#![feature(panic_unwind)] #![feature(staged_api)] #![feature(termination_trait_lib)] #![feature(process_exitcode_placeholder)] @@ -292,7 +294,11 @@ where fn calc_timeout(timeout_queue: &VecDeque) -> Option { timeout_queue.front().map(|&TimeoutEntry { timeout: next_timeout, .. }| { let now = Instant::now(); - if next_timeout >= now { next_timeout - now } else { Duration::new(0, 0) } + if next_timeout >= now { + next_timeout - now + } else { + Duration::new(0, 0) + } }) } From 645eaddc1365c24d9af2f38def5542db265092d1 Mon Sep 17 00:00:00 2001 From: Matt Wilkinson Date: Sun, 21 Nov 2021 21:44:10 -0500 Subject: [PATCH 2/7] stdout/err documentation fix --- library/std/src/sys/windows/io.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/std/src/sys/windows/io.rs b/library/std/src/sys/windows/io.rs index 78750b3cb6cc0..48d4e03f9ee15 100644 --- a/library/std/src/sys/windows/io.rs +++ b/library/std/src/sys/windows/io.rs @@ -114,7 +114,7 @@ impl io::IsTerminal for sys::stdio::Stdout { if unsafe { console_on_any(&[fd]) } { // False positives aren't possible. If we got a console then - // we definitely have a tty on stdin. + // we definitely have a tty on stdout. return true; } @@ -140,7 +140,7 @@ impl io::IsTerminal for sys::stdio::Stderr { if unsafe { console_on_any(&[fd]) } { // False positives aren't possible. If we got a console then - // we definitely have a tty on stdin. + // we definitely have a tty on stderr. return true; } From e7f6e7644ffc63a7977af9a4d07ddbfe2f655d7f Mon Sep 17 00:00:00 2001 From: Matt Wilkinson Date: Sun, 21 Nov 2021 22:09:10 -0500 Subject: [PATCH 3/7] fix windows compile errors --- library/std/src/sys/windows/c.rs | 6 ++++-- library/std/src/sys/windows/io.rs | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs index 5f961a508ba3f..ccd68d073e5d7 100644 --- a/library/std/src/sys/windows/c.rs +++ b/library/std/src/sys/windows/c.rs @@ -124,6 +124,8 @@ pub const SECURITY_SQOS_PRESENT: DWORD = 0x00100000; pub const FIONBIO: c_ulong = 0x8004667e; +pub const MAX_PATH: usize = 260; + #[repr(C)] #[derive(Copy)] pub struct WIN32_FIND_DATAW { @@ -486,8 +488,8 @@ pub struct SYMBOLIC_LINK_REPARSE_BUFFER { #[repr(C)] pub struct FILE_NAME_INFO { - FileNameLength: DWORD, - FileName: [WCHAR; 1], + pub FileNameLength: DWORD, + pub FileName: [WCHAR; 1], } #[repr(C)] diff --git a/library/std/src/sys/windows/io.rs b/library/std/src/sys/windows/io.rs index 48d4e03f9ee15..ce88fd85ffcf2 100644 --- a/library/std/src/sys/windows/io.rs +++ b/library/std/src/sys/windows/io.rs @@ -2,6 +2,9 @@ use crate::io; use crate::marker::PhantomData; use crate::slice; use crate::sys::c; +use crate::sys; +use libc; +use std; #[derive(Copy, Clone)] #[repr(transparent)] @@ -172,11 +175,11 @@ unsafe fn console_on_any(fds: &[c::DWORD]) -> bool { #[unstable(feature = "is_terminal", issue = "80937")] unsafe fn msys_tty_on(fd: c::DWORD) -> bool { let size = std::mem::size_of::(); - let mut name_info_bytes = vec![0u8; size + c::MAX_PATH * std::mem::size_of::()]; + let mut name_info_bytes = vec![0u8; size + c::MAX_PATH * std::mem::size_of::()]; let res = c::GetFileInformationByHandleEx( c::GetStdHandle(fd), c::FileNameInfo, - &mut *name_info_bytes as *mut _ as *mut c::c_void, + &mut *name_info_bytes as *mut _ as *mut libc::c_void, name_info_bytes.len() as u32, ); if res == 0 { From 16194b55e4139283528bff41655fc3534891b413 Mon Sep 17 00:00:00 2001 From: Matt Wilkinson Date: Sun, 21 Nov 2021 22:14:42 -0500 Subject: [PATCH 4/7] windows io.rs formatting fix --- library/std/src/sys/windows/io.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/sys/windows/io.rs b/library/std/src/sys/windows/io.rs index ce88fd85ffcf2..914033cd55226 100644 --- a/library/std/src/sys/windows/io.rs +++ b/library/std/src/sys/windows/io.rs @@ -1,8 +1,8 @@ use crate::io; use crate::marker::PhantomData; use crate::slice; -use crate::sys::c; use crate::sys; +use crate::sys::c; use libc; use std; From 37ae51e3d9cf13d795f1c0d62678e0b70023ada3 Mon Sep 17 00:00:00 2001 From: Matt Wilkinson Date: Sun, 21 Nov 2021 22:25:22 -0500 Subject: [PATCH 5/7] add GetFileInformationByHandleEx C function, and use core:: for mem and slice --- library/std/src/sys/windows/c.rs | 6 ++++++ library/std/src/sys/windows/io.rs | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs index ccd68d073e5d7..902639b93e73a 100644 --- a/library/std/src/sys/windows/c.rs +++ b/library/std/src/sys/windows/c.rs @@ -827,6 +827,12 @@ if #[cfg(not(target_vendor = "uwp"))] { hFile: HANDLE, lpFileInformation: LPBY_HANDLE_FILE_INFORMATION, ) -> BOOL; + pub fn GetFileInformationByHandleEx( + hFile: HANDLE, + FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, + lpFileInformation: LPVOID, + dwBufferSize: DWORD, + ) -> BOOL; pub fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) -> BOOL; pub fn AddVectoredExceptionHandler( FirstHandler: ULONG, diff --git a/library/std/src/sys/windows/io.rs b/library/std/src/sys/windows/io.rs index 914033cd55226..dd6861ff12de0 100644 --- a/library/std/src/sys/windows/io.rs +++ b/library/std/src/sys/windows/io.rs @@ -3,8 +3,8 @@ use crate::marker::PhantomData; use crate::slice; use crate::sys; use crate::sys::c; +use core; use libc; -use std; #[derive(Copy, Clone)] #[repr(transparent)] @@ -174,8 +174,8 @@ unsafe fn console_on_any(fds: &[c::DWORD]) -> bool { } #[unstable(feature = "is_terminal", issue = "80937")] unsafe fn msys_tty_on(fd: c::DWORD) -> bool { - let size = std::mem::size_of::(); - let mut name_info_bytes = vec![0u8; size + c::MAX_PATH * std::mem::size_of::()]; + let size = core::mem::size_of::(); + let mut name_info_bytes = vec![0u8; size + c::MAX_PATH * core::mem::size_of::()]; let res = c::GetFileInformationByHandleEx( c::GetStdHandle(fd), c::FileNameInfo, @@ -186,7 +186,7 @@ unsafe fn msys_tty_on(fd: c::DWORD) -> bool { return false; } let name_info: &c::FILE_NAME_INFO = &*(name_info_bytes.as_ptr() as *const c::FILE_NAME_INFO); - let s = std::slice::from_raw_parts( + let s = core::slice::from_raw_parts( name_info.FileName.as_ptr(), name_info.FileNameLength as usize / 2, ); From 03f076f391fc8509e34d4cd7ca02110be57aab1e Mon Sep 17 00:00:00 2001 From: Matt Wilkinson Date: Sun, 20 Mar 2022 21:47:15 -0400 Subject: [PATCH 6/7] fix import issues and deduplicate winapi implementation Signed-off-by: Matt Wilkinson --- library/std/src/io/mod.rs | 6 ------ library/std/src/lib.rs | 1 - library/std/src/sys/windows/c.rs | 6 ------ 3 files changed, 13 deletions(-) diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index baef80d1beb41..4fd618ec61a8a 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -268,12 +268,6 @@ pub use self::buffered::WriterPanicked; pub use self::stdio::set_output_capture; #[unstable(feature = "is_terminal", issue = "80937")] pub use self::stdio::IsTerminal; -#[stable(feature = "rust1", since = "1.0.0")] -pub use self::stdio::{stderr, stdin, stdout, Stderr, Stdin, Stdout}; -#[unstable(feature = "stdio_locked", issue = "86845")] -pub use self::stdio::{stderr_locked, stdin_locked, stdout_locked}; -#[stable(feature = "rust1", since = "1.0.0")] -pub use self::stdio::{StderrLock, StdinLock, StdoutLock}; #[unstable(feature = "print_internals", issue = "none")] pub use self::stdio::{_eprint, _print}; #[stable(feature = "rust1", since = "1.0.0")] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 480532e0fdb3e..9b096b65f6b51 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -280,7 +280,6 @@ #![feature(int_error_internals)] #![feature(intra_doc_pointers)] #![feature(is_terminal)] -#![feature(iter_zip)] #![feature(lang_items)] #![feature(linkage)] #![feature(log_syntax)] diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs index 902639b93e73a..ccd68d073e5d7 100644 --- a/library/std/src/sys/windows/c.rs +++ b/library/std/src/sys/windows/c.rs @@ -827,12 +827,6 @@ if #[cfg(not(target_vendor = "uwp"))] { hFile: HANDLE, lpFileInformation: LPBY_HANDLE_FILE_INFORMATION, ) -> BOOL; - pub fn GetFileInformationByHandleEx( - hFile: HANDLE, - FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, - lpFileInformation: LPVOID, - dwBufferSize: DWORD, - ) -> BOOL; pub fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) -> BOOL; pub fn AddVectoredExceptionHandler( FirstHandler: ULONG, From a82bae52ce1639224b53b0089267f4599c74c166 Mon Sep 17 00:00:00 2001 From: Matt Wilkinson Date: Sun, 20 Mar 2022 22:16:02 -0400 Subject: [PATCH 7/7] remove hermit from cfg_if Signed-off-by: Matt Wilkinson --- library/std/src/io/stdio.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/io/stdio.rs b/library/std/src/io/stdio.rs index e36dcbfe52168..be102bcc8c50e 100644 --- a/library/std/src/io/stdio.rs +++ b/library/std/src/io/stdio.rs @@ -1026,7 +1026,7 @@ pub trait IsTerminal { } cfg_if::cfg_if! { - if #[cfg(any(unix, windows, hermit))] { + if #[cfg(any(unix, windows))] { #[unstable(feature = "is_terminal", issue = "80937")] impl IsTerminal for Stdin { fn is_terminal() -> bool {