about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-22 22:04:50 +0000
committerbors <bors@rust-lang.org>2024-01-22 22:04:50 +0000
commitd6b151fc77e213bf637db0f12c1965ace3ffe255 (patch)
treee420a6d4c1774e65195f08e30fe1d6c70df1b002 /library/std/src
parentd5fd0997291ca0135401a39dff25c8a9c13b8961 (diff)
parenta787232abb960290eb62051e8236b8449113407c (diff)
Auto merge of #120251 - matthiaskrgr:rollup-gttrw68, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #119664 (Fix tty detection for msys2's `/dev/ptmx`)
 - #120104 (never_patterns: Count `!` bindings as diverging)
 - #120109 (Move cmath into `sys`)
 - #120143 (Consolidate logic around resolving built-in coroutine trait impls)
 - #120159 (Track `verbose` and `verbose_internals`)
 - #120216 (Fix a `trimmed_def_paths` assertion failure.)
 - #120220 (Document `Token{Stream,Tree}::Display` more thoroughly.)
 - #120233 (Revert stabilization of trait_upcasting feature)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sys/cmath/builtins.rs (renamed from library/std/src/sys/pal/unix/cmath.rs)2
-rw-r--r--library/std/src/sys/cmath/mod.rs11
-rw-r--r--library/std/src/sys/cmath/windows.rs (renamed from library/std/src/sys/pal/windows/cmath.rs)2
-rw-r--r--library/std/src/sys/mod.rs4
-rw-r--r--library/std/src/sys/pal/hermit/mod.rs2
-rw-r--r--library/std/src/sys/pal/sgx/mod.rs2
-rw-r--r--library/std/src/sys/pal/solid/mod.rs2
-rw-r--r--library/std/src/sys/pal/teeos/mod.rs2
-rw-r--r--library/std/src/sys/pal/uefi/mod.rs2
-rw-r--r--library/std/src/sys/pal/unix/mod.rs2
-rw-r--r--library/std/src/sys/pal/unsupported/mod.rs2
-rw-r--r--library/std/src/sys/pal/wasi/mod.rs2
-rw-r--r--library/std/src/sys/pal/wasm/mod.rs2
-rw-r--r--library/std/src/sys/pal/windows/io.rs14
-rw-r--r--library/std/src/sys/pal/windows/mod.rs1
-rw-r--r--library/std/src/sys/pal/xous/mod.rs2
16 files changed, 14 insertions, 40 deletions
diff --git a/library/std/src/sys/pal/unix/cmath.rs b/library/std/src/sys/cmath/builtins.rs
index 5346d229116..c680132efa4 100644
--- a/library/std/src/sys/pal/unix/cmath.rs
+++ b/library/std/src/sys/cmath/builtins.rs
@@ -1,5 +1,3 @@
-#![cfg(not(test))]
-
 // These symbols are all defined by `libm`,
 // or by `compiler-builtins` on unsupported platforms.
 
diff --git a/library/std/src/sys/cmath/mod.rs b/library/std/src/sys/cmath/mod.rs
new file mode 100644
index 00000000000..79d5021dd8d
--- /dev/null
+++ b/library/std/src/sys/cmath/mod.rs
@@ -0,0 +1,11 @@
+#![cfg(not(test))]
+
+cfg_if::cfg_if! {
+    if #[cfg(target_os = "windows")] {
+        mod windows;
+        pub use windows::*;
+    } else {
+        mod builtins;
+        pub use builtins::*;
+    }
+}
diff --git a/library/std/src/sys/pal/windows/cmath.rs b/library/std/src/sys/cmath/windows.rs
index 36578d5a34e..712097f06ff 100644
--- a/library/std/src/sys/pal/windows/cmath.rs
+++ b/library/std/src/sys/cmath/windows.rs
@@ -1,5 +1,3 @@
-#![cfg(not(test))]
-
 use core::ffi::{c_double, c_float, c_int};
 
 extern "C" {
diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs
index d95c0d8d062..e03e98b18d2 100644
--- a/library/std/src/sys/mod.rs
+++ b/library/std/src/sys/mod.rs
@@ -3,9 +3,11 @@
 /// descriptors.
 mod pal;
 
-pub mod os_str;
 mod personality;
 
+pub mod cmath;
+pub mod os_str;
+
 // FIXME(117276): remove this, move feature implementations into individual
 //                submodules.
 pub use pal::*;
diff --git a/library/std/src/sys/pal/hermit/mod.rs b/library/std/src/sys/pal/hermit/mod.rs
index 50336296919..3c83afa280b 100644
--- a/library/std/src/sys/pal/hermit/mod.rs
+++ b/library/std/src/sys/pal/hermit/mod.rs
@@ -19,8 +19,6 @@ use crate::os::raw::c_char;
 
 pub mod alloc;
 pub mod args;
-#[path = "../unix/cmath.rs"]
-pub mod cmath;
 pub mod env;
 pub mod fd;
 pub mod fs;
diff --git a/library/std/src/sys/pal/sgx/mod.rs b/library/std/src/sys/pal/sgx/mod.rs
index 893c5f765a7..a769fc1ef59 100644
--- a/library/std/src/sys/pal/sgx/mod.rs
+++ b/library/std/src/sys/pal/sgx/mod.rs
@@ -13,8 +13,6 @@ mod waitqueue;
 
 pub mod alloc;
 pub mod args;
-#[path = "../unix/cmath.rs"]
-pub mod cmath;
 pub mod env;
 pub mod fd;
 #[path = "../unsupported/fs.rs"]
diff --git a/library/std/src/sys/pal/solid/mod.rs b/library/std/src/sys/pal/solid/mod.rs
index 5742ce9d72c..46699e64169 100644
--- a/library/std/src/sys/pal/solid/mod.rs
+++ b/library/std/src/sys/pal/solid/mod.rs
@@ -21,8 +21,6 @@ mod itron {
 pub mod alloc;
 #[path = "../unsupported/args.rs"]
 pub mod args;
-#[path = "../unix/cmath.rs"]
-pub mod cmath;
 pub mod env;
 // `error` is `pub(crate)` so that it can be accessed by `itron/error.rs` as
 // `crate::sys::error`
diff --git a/library/std/src/sys/pal/teeos/mod.rs b/library/std/src/sys/pal/teeos/mod.rs
index 764a4e6ad35..95a5b97ea42 100644
--- a/library/std/src/sys/pal/teeos/mod.rs
+++ b/library/std/src/sys/pal/teeos/mod.rs
@@ -11,8 +11,6 @@ pub use self::rand::hashmap_random_keys;
 pub mod alloc;
 #[path = "../unsupported/args.rs"]
 pub mod args;
-#[path = "../unix/cmath.rs"]
-pub mod cmath;
 #[path = "../unsupported/env.rs"]
 pub mod env;
 pub mod locks;
diff --git a/library/std/src/sys/pal/uefi/mod.rs b/library/std/src/sys/pal/uefi/mod.rs
index fb1a531182a..9ee753aa1a0 100644
--- a/library/std/src/sys/pal/uefi/mod.rs
+++ b/library/std/src/sys/pal/uefi/mod.rs
@@ -14,8 +14,6 @@
 
 pub mod alloc;
 pub mod args;
-#[path = "../unix/cmath.rs"]
-pub mod cmath;
 pub mod env;
 #[path = "../unsupported/fs.rs"]
 pub mod fs;
diff --git a/library/std/src/sys/pal/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs
index 86027c2b0b0..43cb9d89be9 100644
--- a/library/std/src/sys/pal/unix/mod.rs
+++ b/library/std/src/sys/pal/unix/mod.rs
@@ -11,8 +11,6 @@ pub mod weak;
 pub mod alloc;
 pub mod android;
 pub mod args;
-#[path = "../unix/cmath.rs"]
-pub mod cmath;
 pub mod env;
 pub mod fd;
 pub mod fs;
diff --git a/library/std/src/sys/pal/unsupported/mod.rs b/library/std/src/sys/pal/unsupported/mod.rs
index 6254c67a2a3..b56ded8579c 100644
--- a/library/std/src/sys/pal/unsupported/mod.rs
+++ b/library/std/src/sys/pal/unsupported/mod.rs
@@ -2,8 +2,6 @@
 
 pub mod alloc;
 pub mod args;
-#[path = "../unix/cmath.rs"]
-pub mod cmath;
 pub mod env;
 pub mod fs;
 pub mod io;
diff --git a/library/std/src/sys/pal/wasi/mod.rs b/library/std/src/sys/pal/wasi/mod.rs
index c1fc053bf04..4ffc8ecdd67 100644
--- a/library/std/src/sys/pal/wasi/mod.rs
+++ b/library/std/src/sys/pal/wasi/mod.rs
@@ -20,8 +20,6 @@ use crate::mem;
 #[path = "../unix/alloc.rs"]
 pub mod alloc;
 pub mod args;
-#[path = "../unix/cmath.rs"]
-pub mod cmath;
 pub mod env;
 pub mod fd;
 pub mod fs;
diff --git a/library/std/src/sys/pal/wasm/mod.rs b/library/std/src/sys/pal/wasm/mod.rs
index d2181565887..76306b618d8 100644
--- a/library/std/src/sys/pal/wasm/mod.rs
+++ b/library/std/src/sys/pal/wasm/mod.rs
@@ -19,8 +19,6 @@
 pub mod alloc;
 #[path = "../unsupported/args.rs"]
 pub mod args;
-#[path = "../unix/cmath.rs"]
-pub mod cmath;
 pub mod env;
 #[path = "../unsupported/fs.rs"]
 pub mod fs;
diff --git a/library/std/src/sys/pal/windows/io.rs b/library/std/src/sys/pal/windows/io.rs
index 649826d25ce..b73d9f3ff4c 100644
--- a/library/std/src/sys/pal/windows/io.rs
+++ b/library/std/src/sys/pal/windows/io.rs
@@ -97,20 +97,6 @@ unsafe fn handle_is_console(handle: BorrowedHandle<'_>) -> bool {
         return true;
     }
 
-    // At this point, we *could* have a false negative. We can determine that this is a true
-    // negative if we can detect the presence of a console on any of the standard I/O streams. If
-    // another stream has a console, then we know we're in a Windows console and can therefore
-    // trust the negative.
-    for std_handle in [c::STD_INPUT_HANDLE, c::STD_OUTPUT_HANDLE, c::STD_ERROR_HANDLE] {
-        let std_handle = c::GetStdHandle(std_handle);
-        if !std_handle.is_null()
-            && std_handle != handle
-            && c::GetConsoleMode(std_handle, &mut out) != 0
-        {
-            return false;
-        }
-    }
-
     // Otherwise, we fall back to an msys hack to see if we can detect the presence of a pty.
     msys_tty_on(handle)
 }
diff --git a/library/std/src/sys/pal/windows/mod.rs b/library/std/src/sys/pal/windows/mod.rs
index d097a7b8bb2..364521dba40 100644
--- a/library/std/src/sys/pal/windows/mod.rs
+++ b/library/std/src/sys/pal/windows/mod.rs
@@ -15,7 +15,6 @@ pub mod compat;
 pub mod alloc;
 pub mod args;
 pub mod c;
-pub mod cmath;
 pub mod env;
 pub mod fs;
 pub mod handle;
diff --git a/library/std/src/sys/pal/xous/mod.rs b/library/std/src/sys/pal/xous/mod.rs
index 516d0a68720..b4948d7e583 100644
--- a/library/std/src/sys/pal/xous/mod.rs
+++ b/library/std/src/sys/pal/xous/mod.rs
@@ -3,8 +3,6 @@
 pub mod alloc;
 #[path = "../unsupported/args.rs"]
 pub mod args;
-#[path = "../unix/cmath.rs"]
-pub mod cmath;
 #[path = "../unsupported/env.rs"]
 pub mod env;
 #[path = "../unsupported/fs.rs"]