about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorThe rustc-dev-guide Cronjob Bot <github-actions@github.com>2025-04-21 04:03:09 +0000
committerThe rustc-dev-guide Cronjob Bot <github-actions@github.com>2025-04-21 04:03:09 +0000
commitd12c1f581f97ca0fe67d1498fa2c34b61a8bd189 (patch)
treecad0adefe81f03e6b1727edbe2ff7cd35f33ebf2 /library/std/src
parent49b62eeacc0b57c01464577c5f3437f2f29f9683 (diff)
parentb8005bff3248cfc6e327faf4fa631ac49bb49ba9 (diff)
downloadrust-d12c1f581f97ca0fe67d1498fa2c34b61a8bd189.tar.gz
rust-d12c1f581f97ca0fe67d1498fa2c34b61a8bd189.zip
Merge from rustc
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/env.rs2
-rw-r--r--library/std/src/sys/env_consts.rs (renamed from library/std/src/sys/pal/unix/env.rs)283
-rw-r--r--library/std/src/sys/fs/unix.rs9
-rw-r--r--library/std/src/sys/mod.rs1
-rw-r--r--library/std/src/sys/pal/hermit/env.rs9
-rw-r--r--library/std/src/sys/pal/hermit/mod.rs1
-rw-r--r--library/std/src/sys/pal/sgx/env.rs9
-rw-r--r--library/std/src/sys/pal/sgx/mod.rs1
-rw-r--r--library/std/src/sys/pal/solid/env.rs9
-rw-r--r--library/std/src/sys/pal/solid/mod.rs1
-rw-r--r--library/std/src/sys/pal/teeos/mod.rs3
-rw-r--r--library/std/src/sys/pal/trusty/mod.rs2
-rw-r--r--library/std/src/sys/pal/uefi/env.rs9
-rw-r--r--library/std/src/sys/pal/uefi/mod.rs1
-rw-r--r--library/std/src/sys/pal/unix/mod.rs1
-rw-r--r--library/std/src/sys/pal/unsupported/env.rs9
-rw-r--r--library/std/src/sys/pal/unsupported/mod.rs1
-rw-r--r--library/std/src/sys/pal/wasi/env.rs11
-rw-r--r--library/std/src/sys/pal/wasi/mod.rs1
-rw-r--r--library/std/src/sys/pal/wasip2/mod.rs2
-rw-r--r--library/std/src/sys/pal/wasm/env.rs9
-rw-r--r--library/std/src/sys/pal/wasm/mod.rs1
-rw-r--r--library/std/src/sys/pal/windows/env.rs9
-rw-r--r--library/std/src/sys/pal/windows/mod.rs1
-rw-r--r--library/std/src/sys/pal/xous/mod.rs2
-rw-r--r--library/std/src/sys/pal/zkvm/mod.rs1
26 files changed, 198 insertions, 190 deletions
diff --git a/library/std/src/env.rs b/library/std/src/env.rs
index 05bd4345ea8..c84a72c4fad 100644
--- a/library/std/src/env.rs
+++ b/library/std/src/env.rs
@@ -950,7 +950,7 @@ impl fmt::Debug for ArgsOs {
 /// Constants associated with the current target
 #[stable(feature = "env", since = "1.0.0")]
 pub mod consts {
-    use crate::sys::env::os;
+    use crate::sys::env_consts::os;
 
     /// A string describing the architecture of the CPU that is currently in use.
     /// An example value may be: `"x86"`, `"arm"` or `"riscv64"`.
diff --git a/library/std/src/sys/pal/unix/env.rs b/library/std/src/sys/env_consts.rs
index c6609298f4b..018d7954db2 100644
--- a/library/std/src/sys/pal/unix/env.rs
+++ b/library/std/src/sys/env_consts.rs
@@ -1,73 +1,79 @@
-#[cfg(target_os = "linux")]
-pub mod os {
-    pub const FAMILY: &str = "unix";
-    pub const OS: &str = "linux";
-    pub const DLL_PREFIX: &str = "lib";
-    pub const DLL_SUFFIX: &str = ".so";
-    pub const DLL_EXTENSION: &str = "so";
-    pub const EXE_SUFFIX: &str = "";
-    pub const EXE_EXTENSION: &str = "";
+//! Constants associated with each target.
+
+// Replaces the #[else] gate with #[cfg(not(any(…)))] of all the other gates.
+// This ensures that they must be mutually exclusive and do not have precedence
+// like cfg_if!.
+macro cfg_unordered(
+    $(#[cfg($cfg:meta)] $os:item)*
+    #[else] $fallback:item
+) {
+    $(#[cfg($cfg)] $os)*
+    #[cfg(not(any($($cfg),*)))] $fallback
 }
 
-#[cfg(target_os = "macos")]
+// Keep entries sorted alphabetically and mutually exclusive.
+
+cfg_unordered! {
+
+#[cfg(target_os = "aix")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "macos";
+    pub const OS: &str = "aix";
     pub const DLL_PREFIX: &str = "lib";
-    pub const DLL_SUFFIX: &str = ".dylib";
-    pub const DLL_EXTENSION: &str = "dylib";
+    pub const DLL_SUFFIX: &str = ".a";
+    pub const DLL_EXTENSION: &str = "a";
     pub const EXE_SUFFIX: &str = "";
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "ios")]
+#[cfg(target_os = "android")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "ios";
+    pub const OS: &str = "android";
     pub const DLL_PREFIX: &str = "lib";
-    pub const DLL_SUFFIX: &str = ".dylib";
-    pub const DLL_EXTENSION: &str = "dylib";
+    pub const DLL_SUFFIX: &str = ".so";
+    pub const DLL_EXTENSION: &str = "so";
     pub const EXE_SUFFIX: &str = "";
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "tvos")]
+#[cfg(target_os = "cygwin")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "tvos";
-    pub const DLL_PREFIX: &str = "lib";
-    pub const DLL_SUFFIX: &str = ".dylib";
-    pub const DLL_EXTENSION: &str = "dylib";
-    pub const EXE_SUFFIX: &str = "";
-    pub const EXE_EXTENSION: &str = "";
+    pub const OS: &str = "cygwin";
+    pub const DLL_PREFIX: &str = "";
+    pub const DLL_SUFFIX: &str = ".dll";
+    pub const DLL_EXTENSION: &str = "dll";
+    pub const EXE_SUFFIX: &str = ".exe";
+    pub const EXE_EXTENSION: &str = "exe";
 }
 
-#[cfg(target_os = "watchos")]
+#[cfg(target_os = "dragonfly")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "watchos";
+    pub const OS: &str = "dragonfly";
     pub const DLL_PREFIX: &str = "lib";
-    pub const DLL_SUFFIX: &str = ".dylib";
-    pub const DLL_EXTENSION: &str = "dylib";
+    pub const DLL_SUFFIX: &str = ".so";
+    pub const DLL_EXTENSION: &str = "so";
     pub const EXE_SUFFIX: &str = "";
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "visionos")]
+#[cfg(target_os = "emscripten")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "visionos";
+    pub const OS: &str = "emscripten";
     pub const DLL_PREFIX: &str = "lib";
-    pub const DLL_SUFFIX: &str = ".dylib";
-    pub const DLL_EXTENSION: &str = "dylib";
-    pub const EXE_SUFFIX: &str = "";
-    pub const EXE_EXTENSION: &str = "";
+    pub const DLL_SUFFIX: &str = ".so";
+    pub const DLL_EXTENSION: &str = "so";
+    pub const EXE_SUFFIX: &str = ".js";
+    pub const EXE_EXTENSION: &str = "js";
 }
 
-#[cfg(target_os = "freebsd")]
+#[cfg(target_os = "espidf")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "freebsd";
+    pub const OS: &str = "espidf";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
@@ -75,10 +81,10 @@ pub mod os {
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "dragonfly")]
+#[cfg(target_os = "freebsd")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "dragonfly";
+    pub const OS: &str = "freebsd";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
@@ -86,10 +92,10 @@ pub mod os {
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "netbsd")]
+#[cfg(target_os = "fuchsia")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "netbsd";
+    pub const OS: &str = "fuchsia";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
@@ -97,10 +103,10 @@ pub mod os {
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "openbsd")]
+#[cfg(target_os = "haiku")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "openbsd";
+    pub const OS: &str = "haiku";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
@@ -108,32 +114,32 @@ pub mod os {
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "cygwin")]
+#[cfg(target_os = "hermit")]
 pub mod os {
-    pub const FAMILY: &str = "unix";
-    pub const OS: &str = "cygwin";
+    pub const FAMILY: &str = "";
+    pub const OS: &str = "hermit";
     pub const DLL_PREFIX: &str = "";
-    pub const DLL_SUFFIX: &str = ".dll";
-    pub const DLL_EXTENSION: &str = "dll";
-    pub const EXE_SUFFIX: &str = ".exe";
-    pub const EXE_EXTENSION: &str = "exe";
+    pub const DLL_SUFFIX: &str = "";
+    pub const DLL_EXTENSION: &str = "";
+    pub const EXE_SUFFIX: &str = "";
+    pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "android")]
+#[cfg(target_os = "horizon")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "android";
+    pub const OS: &str = "horizon";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
-    pub const EXE_SUFFIX: &str = "";
-    pub const EXE_EXTENSION: &str = "";
+    pub const EXE_SUFFIX: &str = ".elf";
+    pub const EXE_EXTENSION: &str = "elf";
 }
 
-#[cfg(target_os = "solaris")]
+#[cfg(target_os = "hurd")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "solaris";
+    pub const OS: &str = "hurd";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
@@ -152,32 +158,32 @@ pub mod os {
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "haiku")]
+#[cfg(target_os = "ios")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "haiku";
+    pub const OS: &str = "ios";
     pub const DLL_PREFIX: &str = "lib";
-    pub const DLL_SUFFIX: &str = ".so";
-    pub const DLL_EXTENSION: &str = "so";
+    pub const DLL_SUFFIX: &str = ".dylib";
+    pub const DLL_EXTENSION: &str = "dylib";
     pub const EXE_SUFFIX: &str = "";
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "horizon")]
+#[cfg(target_os = "l4re")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "horizon";
+    pub const OS: &str = "l4re";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
-    pub const EXE_SUFFIX: &str = ".elf";
-    pub const EXE_EXTENSION: &str = "elf";
+    pub const EXE_SUFFIX: &str = "";
+    pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "hurd")]
+#[cfg(target_os = "linux")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "hurd";
+    pub const OS: &str = "linux";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
@@ -185,32 +191,32 @@ pub mod os {
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "vita")]
+#[cfg(target_os = "macos")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "vita";
+    pub const OS: &str = "macos";
     pub const DLL_PREFIX: &str = "lib";
-    pub const DLL_SUFFIX: &str = ".so";
-    pub const DLL_EXTENSION: &str = "so";
-    pub const EXE_SUFFIX: &str = ".elf";
-    pub const EXE_EXTENSION: &str = "elf";
+    pub const DLL_SUFFIX: &str = ".dylib";
+    pub const DLL_EXTENSION: &str = "dylib";
+    pub const EXE_SUFFIX: &str = "";
+    pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(all(target_os = "emscripten", target_arch = "wasm32"))]
+#[cfg(target_os = "netbsd")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "emscripten";
+    pub const OS: &str = "netbsd";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
-    pub const EXE_SUFFIX: &str = ".js";
-    pub const EXE_EXTENSION: &str = "js";
+    pub const EXE_SUFFIX: &str = "";
+    pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "fuchsia")]
+#[cfg(target_os = "nto")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "fuchsia";
+    pub const OS: &str = "nto";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
@@ -218,10 +224,10 @@ pub mod os {
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "l4re")]
+#[cfg(target_os = "nuttx")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "l4re";
+    pub const OS: &str = "nuttx";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
@@ -229,10 +235,10 @@ pub mod os {
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "nto")]
+#[cfg(target_os = "openbsd")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "nto";
+    pub const OS: &str = "openbsd";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
@@ -262,10 +268,21 @@ pub mod os {
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "vxworks")]
+#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
+pub mod os {
+    pub const FAMILY: &str = "";
+    pub const OS: &str = "";
+    pub const DLL_PREFIX: &str = "";
+    pub const DLL_SUFFIX: &str = ".sgxs";
+    pub const DLL_EXTENSION: &str = "sgxs";
+    pub const EXE_SUFFIX: &str = ".sgxs";
+    pub const EXE_EXTENSION: &str = "sgxs";
+}
+
+#[cfg(target_os = "solaris")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "vxworks";
+    pub const OS: &str = "solaris";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
@@ -273,35 +290,115 @@ pub mod os {
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "espidf")]
+#[cfg(target_os = "solid_asp3")]
 pub mod os {
-    pub const FAMILY: &str = "unix";
-    pub const OS: &str = "espidf";
-    pub const DLL_PREFIX: &str = "lib";
+    pub const FAMILY: &str = "itron";
+    pub const OS: &str = "solid";
+    pub const DLL_PREFIX: &str = "";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
     pub const EXE_SUFFIX: &str = "";
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "aix")]
+#[cfg(target_os = "tvos")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "aix";
+    pub const OS: &str = "tvos";
     pub const DLL_PREFIX: &str = "lib";
-    pub const DLL_SUFFIX: &str = ".a";
-    pub const DLL_EXTENSION: &str = "a";
+    pub const DLL_SUFFIX: &str = ".dylib";
+    pub const DLL_EXTENSION: &str = "dylib";
     pub const EXE_SUFFIX: &str = "";
     pub const EXE_EXTENSION: &str = "";
 }
 
-#[cfg(target_os = "nuttx")]
+#[cfg(target_os = "uefi")]
+pub mod os {
+    pub const FAMILY: &str = "";
+    pub const OS: &str = "uefi";
+    pub const DLL_PREFIX: &str = "";
+    pub const DLL_SUFFIX: &str = "";
+    pub const DLL_EXTENSION: &str = "";
+    pub const EXE_SUFFIX: &str = ".efi";
+    pub const EXE_EXTENSION: &str = "efi";
+}
+
+#[cfg(target_os = "visionos")]
 pub mod os {
     pub const FAMILY: &str = "unix";
-    pub const OS: &str = "nuttx";
+    pub const OS: &str = "visionos";
+    pub const DLL_PREFIX: &str = "lib";
+    pub const DLL_SUFFIX: &str = ".dylib";
+    pub const DLL_EXTENSION: &str = "dylib";
+    pub const EXE_SUFFIX: &str = "";
+    pub const EXE_EXTENSION: &str = "";
+}
+
+#[cfg(target_os = "vita")]
+pub mod os {
+    pub const FAMILY: &str = "unix";
+    pub const OS: &str = "vita";
+    pub const DLL_PREFIX: &str = "lib";
+    pub const DLL_SUFFIX: &str = ".so";
+    pub const DLL_EXTENSION: &str = "so";
+    pub const EXE_SUFFIX: &str = ".elf";
+    pub const EXE_EXTENSION: &str = "elf";
+}
+
+#[cfg(target_os = "vxworks")]
+pub mod os {
+    pub const FAMILY: &str = "unix";
+    pub const OS: &str = "vxworks";
     pub const DLL_PREFIX: &str = "lib";
     pub const DLL_SUFFIX: &str = ".so";
     pub const DLL_EXTENSION: &str = "so";
     pub const EXE_SUFFIX: &str = "";
     pub const EXE_EXTENSION: &str = "";
 }
+
+#[cfg(all(target_family = "wasm", not(any(target_os = "emscripten", target_os = "linux"))))]
+pub mod os {
+    pub const FAMILY: &str = "";
+    pub const OS: &str = "";
+    pub const DLL_PREFIX: &str = "";
+    pub const DLL_SUFFIX: &str = ".wasm";
+    pub const DLL_EXTENSION: &str = "wasm";
+    pub const EXE_SUFFIX: &str = ".wasm";
+    pub const EXE_EXTENSION: &str = "wasm";
+}
+
+#[cfg(target_os = "watchos")]
+pub mod os {
+    pub const FAMILY: &str = "unix";
+    pub const OS: &str = "watchos";
+    pub const DLL_PREFIX: &str = "lib";
+    pub const DLL_SUFFIX: &str = ".dylib";
+    pub const DLL_EXTENSION: &str = "dylib";
+    pub const EXE_SUFFIX: &str = "";
+    pub const EXE_EXTENSION: &str = "";
+}
+
+#[cfg(target_os = "windows")]
+pub mod os {
+    pub const FAMILY: &str = "windows";
+    pub const OS: &str = "windows";
+    pub const DLL_PREFIX: &str = "";
+    pub const DLL_SUFFIX: &str = ".dll";
+    pub const DLL_EXTENSION: &str = "dll";
+    pub const EXE_SUFFIX: &str = ".exe";
+    pub const EXE_EXTENSION: &str = "exe";
+}
+
+// The fallback when none of the other gates match.
+#[else]
+pub mod os {
+    pub const FAMILY: &str = "";
+    pub const OS: &str = "";
+    pub const DLL_PREFIX: &str = "";
+    pub const DLL_SUFFIX: &str = "";
+    pub const DLL_EXTENSION: &str = "";
+    pub const EXE_SUFFIX: &str = "";
+    pub const EXE_EXTENSION: &str = "";
+}
+
+}
diff --git a/library/std/src/sys/fs/unix.rs b/library/std/src/sys/fs/unix.rs
index 687fc322e59..bc8817bac70 100644
--- a/library/std/src/sys/fs/unix.rs
+++ b/library/std/src/sys/fs/unix.rs
@@ -12,10 +12,11 @@ use libc::c_char;
     all(target_os = "linux", not(target_env = "musl")),
     target_os = "android",
     target_os = "fuchsia",
-    target_os = "hurd"
+    target_os = "hurd",
+    target_os = "illumos",
 ))]
 use libc::dirfd;
-#[cfg(target_os = "fuchsia")]
+#[cfg(any(target_os = "fuchsia", target_os = "illumos"))]
 use libc::fstatat as fstatat64;
 #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "hurd"))]
 use libc::fstatat64;
@@ -892,7 +893,8 @@ impl DirEntry {
             all(target_os = "linux", not(target_env = "musl")),
             target_os = "android",
             target_os = "fuchsia",
-            target_os = "hurd"
+            target_os = "hurd",
+            target_os = "illumos",
         ),
         not(miri) // no dirfd on Miri
     ))]
@@ -922,6 +924,7 @@ impl DirEntry {
             target_os = "android",
             target_os = "fuchsia",
             target_os = "hurd",
+            target_os = "illumos",
         )),
         miri
     ))]
diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs
index bc4bf11cb74..e7b631999e0 100644
--- a/library/std/src/sys/mod.rs
+++ b/library/std/src/sys/mod.rs
@@ -12,6 +12,7 @@ pub mod anonymous_pipe;
 pub mod args;
 pub mod backtrace;
 pub mod cmath;
+pub mod env_consts;
 pub mod exit_guard;
 pub mod fd;
 pub mod fs;
diff --git a/library/std/src/sys/pal/hermit/env.rs b/library/std/src/sys/pal/hermit/env.rs
deleted file mode 100644
index 7a0fcb31ef2..00000000000
--- a/library/std/src/sys/pal/hermit/env.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-pub mod os {
-    pub const FAMILY: &str = "";
-    pub const OS: &str = "hermit";
-    pub const DLL_PREFIX: &str = "";
-    pub const DLL_SUFFIX: &str = "";
-    pub const DLL_EXTENSION: &str = "";
-    pub const EXE_SUFFIX: &str = "";
-    pub const EXE_EXTENSION: &str = "";
-}
diff --git a/library/std/src/sys/pal/hermit/mod.rs b/library/std/src/sys/pal/hermit/mod.rs
index 821836824e2..70636760a83 100644
--- a/library/std/src/sys/pal/hermit/mod.rs
+++ b/library/std/src/sys/pal/hermit/mod.rs
@@ -18,7 +18,6 @@
 
 use crate::os::raw::c_char;
 
-pub mod env;
 pub mod futex;
 pub mod os;
 #[path = "../unsupported/pipe.rs"]
diff --git a/library/std/src/sys/pal/sgx/env.rs b/library/std/src/sys/pal/sgx/env.rs
deleted file mode 100644
index 8043b7c5213..00000000000
--- a/library/std/src/sys/pal/sgx/env.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-pub mod os {
-    pub const FAMILY: &str = "";
-    pub const OS: &str = "";
-    pub const DLL_PREFIX: &str = "";
-    pub const DLL_SUFFIX: &str = ".sgxs";
-    pub const DLL_EXTENSION: &str = "sgxs";
-    pub const EXE_SUFFIX: &str = ".sgxs";
-    pub const EXE_EXTENSION: &str = "sgxs";
-}
diff --git a/library/std/src/sys/pal/sgx/mod.rs b/library/std/src/sys/pal/sgx/mod.rs
index 8a87e7a7ae1..99735947e2c 100644
--- a/library/std/src/sys/pal/sgx/mod.rs
+++ b/library/std/src/sys/pal/sgx/mod.rs
@@ -9,7 +9,6 @@ use crate::io::ErrorKind;
 use crate::sync::atomic::{AtomicBool, Ordering};
 
 pub mod abi;
-pub mod env;
 mod libunwind_integration;
 pub mod os;
 #[path = "../unsupported/pipe.rs"]
diff --git a/library/std/src/sys/pal/solid/env.rs b/library/std/src/sys/pal/solid/env.rs
deleted file mode 100644
index 6855c113b28..00000000000
--- a/library/std/src/sys/pal/solid/env.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-pub mod os {
-    pub const FAMILY: &str = "itron";
-    pub const OS: &str = "solid";
-    pub const DLL_PREFIX: &str = "";
-    pub const DLL_SUFFIX: &str = ".so";
-    pub const DLL_EXTENSION: &str = "so";
-    pub const EXE_SUFFIX: &str = "";
-    pub const EXE_EXTENSION: &str = "";
-}
diff --git a/library/std/src/sys/pal/solid/mod.rs b/library/std/src/sys/pal/solid/mod.rs
index c41dc848a1b..0011cf256df 100644
--- a/library/std/src/sys/pal/solid/mod.rs
+++ b/library/std/src/sys/pal/solid/mod.rs
@@ -16,7 +16,6 @@ pub mod itron {
     use super::unsupported;
 }
 
-pub mod env;
 // `error` is `pub(crate)` so that it can be accessed by `itron/error.rs` as
 // `crate::sys::error`
 pub(crate) mod error;
diff --git a/library/std/src/sys/pal/teeos/mod.rs b/library/std/src/sys/pal/teeos/mod.rs
index b8095cec3e9..c7b17777258 100644
--- a/library/std/src/sys/pal/teeos/mod.rs
+++ b/library/std/src/sys/pal/teeos/mod.rs
@@ -6,9 +6,6 @@
 #![allow(unused_variables)]
 #![allow(dead_code)]
 
-#[path = "../unsupported/env.rs"]
-pub mod env;
-//pub mod fd;
 pub mod os;
 #[path = "../unsupported/pipe.rs"]
 pub mod pipe;
diff --git a/library/std/src/sys/pal/trusty/mod.rs b/library/std/src/sys/pal/trusty/mod.rs
index 04e6b4c8186..275f6062463 100644
--- a/library/std/src/sys/pal/trusty/mod.rs
+++ b/library/std/src/sys/pal/trusty/mod.rs
@@ -3,8 +3,6 @@
 #[path = "../unsupported/common.rs"]
 #[deny(unsafe_op_in_unsafe_fn)]
 mod common;
-#[path = "../unsupported/env.rs"]
-pub mod env;
 #[path = "../unsupported/os.rs"]
 pub mod os;
 #[path = "../unsupported/pipe.rs"]
diff --git a/library/std/src/sys/pal/uefi/env.rs b/library/std/src/sys/pal/uefi/env.rs
deleted file mode 100644
index c106d5fed3e..00000000000
--- a/library/std/src/sys/pal/uefi/env.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-pub mod os {
-    pub const FAMILY: &str = "";
-    pub const OS: &str = "uefi";
-    pub const DLL_PREFIX: &str = "";
-    pub const DLL_SUFFIX: &str = "";
-    pub const DLL_EXTENSION: &str = "";
-    pub const EXE_SUFFIX: &str = ".efi";
-    pub const EXE_EXTENSION: &str = "efi";
-}
diff --git a/library/std/src/sys/pal/uefi/mod.rs b/library/std/src/sys/pal/uefi/mod.rs
index cd901f48b76..bd6a36021f4 100644
--- a/library/std/src/sys/pal/uefi/mod.rs
+++ b/library/std/src/sys/pal/uefi/mod.rs
@@ -13,7 +13,6 @@
 //! [`OsString`]: crate::ffi::OsString
 #![forbid(unsafe_op_in_unsafe_fn)]
 
-pub mod env;
 pub mod helpers;
 pub mod os;
 #[path = "../unsupported/pipe.rs"]
diff --git a/library/std/src/sys/pal/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs
index 3a790d9c868..a4702ae1b18 100644
--- a/library/std/src/sys/pal/unix/mod.rs
+++ b/library/std/src/sys/pal/unix/mod.rs
@@ -6,7 +6,6 @@ use crate::io::ErrorKind;
 #[macro_use]
 pub mod weak;
 
-pub mod env;
 #[cfg(target_os = "fuchsia")]
 pub mod fuchsia;
 pub mod futex;
diff --git a/library/std/src/sys/pal/unsupported/env.rs b/library/std/src/sys/pal/unsupported/env.rs
deleted file mode 100644
index d2efec506c5..00000000000
--- a/library/std/src/sys/pal/unsupported/env.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-pub mod os {
-    pub const FAMILY: &str = "";
-    pub const OS: &str = "";
-    pub const DLL_PREFIX: &str = "";
-    pub const DLL_SUFFIX: &str = "";
-    pub const DLL_EXTENSION: &str = "";
-    pub const EXE_SUFFIX: &str = "";
-    pub const EXE_EXTENSION: &str = "";
-}
diff --git a/library/std/src/sys/pal/unsupported/mod.rs b/library/std/src/sys/pal/unsupported/mod.rs
index dea42a95dcc..5e3295b1331 100644
--- a/library/std/src/sys/pal/unsupported/mod.rs
+++ b/library/std/src/sys/pal/unsupported/mod.rs
@@ -1,6 +1,5 @@
 #![deny(unsafe_op_in_unsafe_fn)]
 
-pub mod env;
 pub mod os;
 pub mod pipe;
 pub mod thread;
diff --git a/library/std/src/sys/pal/wasi/env.rs b/library/std/src/sys/pal/wasi/env.rs
deleted file mode 100644
index 8d444982673..00000000000
--- a/library/std/src/sys/pal/wasi/env.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-#![forbid(unsafe_op_in_unsafe_fn)]
-
-pub mod os {
-    pub const FAMILY: &str = "";
-    pub const OS: &str = "";
-    pub const DLL_PREFIX: &str = "";
-    pub const DLL_SUFFIX: &str = ".wasm";
-    pub const DLL_EXTENSION: &str = "wasm";
-    pub const EXE_SUFFIX: &str = ".wasm";
-    pub const EXE_EXTENSION: &str = "wasm";
-}
diff --git a/library/std/src/sys/pal/wasi/mod.rs b/library/std/src/sys/pal/wasi/mod.rs
index 4ea42b1082b..61dd1c3f98b 100644
--- a/library/std/src/sys/pal/wasi/mod.rs
+++ b/library/std/src/sys/pal/wasi/mod.rs
@@ -13,7 +13,6 @@
 //! compiling for wasm. That way it's a compile time error for something that's
 //! guaranteed to be a runtime error!
 
-pub mod env;
 #[allow(unused)]
 #[path = "../wasm/atomics/futex.rs"]
 pub mod futex;
diff --git a/library/std/src/sys/pal/wasip2/mod.rs b/library/std/src/sys/pal/wasip2/mod.rs
index 6445bf2cc0d..47fe3221c90 100644
--- a/library/std/src/sys/pal/wasip2/mod.rs
+++ b/library/std/src/sys/pal/wasip2/mod.rs
@@ -6,8 +6,6 @@
 //! To begin with, this target mirrors the wasi target 1 to 1, but over
 //! time this will change significantly.
 
-#[path = "../wasi/env.rs"]
-pub mod env;
 #[allow(unused)]
 #[path = "../wasm/atomics/futex.rs"]
 pub mod futex;
diff --git a/library/std/src/sys/pal/wasm/env.rs b/library/std/src/sys/pal/wasm/env.rs
deleted file mode 100644
index 730e356d7fe..00000000000
--- a/library/std/src/sys/pal/wasm/env.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-pub mod os {
-    pub const FAMILY: &str = "";
-    pub const OS: &str = "";
-    pub const DLL_PREFIX: &str = "";
-    pub const DLL_SUFFIX: &str = ".wasm";
-    pub const DLL_EXTENSION: &str = "wasm";
-    pub const EXE_SUFFIX: &str = ".wasm";
-    pub const EXE_EXTENSION: &str = "wasm";
-}
diff --git a/library/std/src/sys/pal/wasm/mod.rs b/library/std/src/sys/pal/wasm/mod.rs
index af370020d96..37cb46a8f6b 100644
--- a/library/std/src/sys/pal/wasm/mod.rs
+++ b/library/std/src/sys/pal/wasm/mod.rs
@@ -16,7 +16,6 @@
 
 #![deny(unsafe_op_in_unsafe_fn)]
 
-pub mod env;
 #[path = "../unsupported/os.rs"]
 pub mod os;
 #[path = "../unsupported/pipe.rs"]
diff --git a/library/std/src/sys/pal/windows/env.rs b/library/std/src/sys/pal/windows/env.rs
deleted file mode 100644
index f0a99d6200c..00000000000
--- a/library/std/src/sys/pal/windows/env.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-pub mod os {
-    pub const FAMILY: &str = "windows";
-    pub const OS: &str = "windows";
-    pub const DLL_PREFIX: &str = "";
-    pub const DLL_SUFFIX: &str = ".dll";
-    pub const DLL_EXTENSION: &str = "dll";
-    pub const EXE_SUFFIX: &str = ".exe";
-    pub const EXE_EXTENSION: &str = "exe";
-}
diff --git a/library/std/src/sys/pal/windows/mod.rs b/library/std/src/sys/pal/windows/mod.rs
index 3c0a5c2de26..4f18c4009ab 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 api;
 
 pub mod c;
-pub mod env;
 #[cfg(not(target_vendor = "win7"))]
 pub mod futex;
 pub mod handle;
diff --git a/library/std/src/sys/pal/xous/mod.rs b/library/std/src/sys/pal/xous/mod.rs
index 4f652d3f130..383d031ed43 100644
--- a/library/std/src/sys/pal/xous/mod.rs
+++ b/library/std/src/sys/pal/xous/mod.rs
@@ -1,7 +1,5 @@
 #![forbid(unsafe_op_in_unsafe_fn)]
 
-#[path = "../unsupported/env.rs"]
-pub mod env;
 pub mod os;
 #[path = "../unsupported/pipe.rs"]
 pub mod pipe;
diff --git a/library/std/src/sys/pal/zkvm/mod.rs b/library/std/src/sys/pal/zkvm/mod.rs
index ebd7b036779..e1efa240685 100644
--- a/library/std/src/sys/pal/zkvm/mod.rs
+++ b/library/std/src/sys/pal/zkvm/mod.rs
@@ -11,7 +11,6 @@
 pub const WORD_SIZE: usize = size_of::<u32>();
 
 pub mod abi;
-pub mod env;
 pub mod os;
 #[path = "../unsupported/pipe.rs"]
 pub mod pipe;