about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-05-05 14:15:19 +0000
committerbors <bors@rust-lang.org>2021-05-05 14:15:19 +0000
commit342db70ae4ecc3cd17e4fa6497f0a8d9534ccfeb (patch)
treee18b3678cfc15269ce32a88a453f6c810a3c5194 /library/std/src
parent24acc388da2cdbe1ec79b6933402941b6fffb26b (diff)
parent2173d8dbe67790e0054876de99fcbfafdb4f8ecd (diff)
downloadrust-342db70ae4ecc3cd17e4fa6497f0a8d9534ccfeb.tar.gz
rust-342db70ae4ecc3cd17e4fa6497f0a8d9534ccfeb.zip
Auto merge of #84200 - CDirkx:os, r=m-ou-se
Move all `sys::ext` modules to `os`

This PR moves all `sys::ext` modules to `os`, centralizing the location of all `os` code and simplifying the dependencies between `os` and `sys`.

Because this also removes all uses `cfg_if!` on publicly exported items, where after #81969 there were still a few left, this should properly work around https://github.com/rust-analyzer/rust-analyzer/issues/6038.

`@rustbot` label: +T-libs-impl
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/os/fortanix_sgx/arch.rs (renamed from library/std/src/sys/sgx/ext/arch.rs)0
-rw-r--r--library/std/src/os/fortanix_sgx/ffi.rs (renamed from library/std/src/sys/sgx/ext/ffi.rs)0
-rw-r--r--library/std/src/os/fortanix_sgx/io.rs (renamed from library/std/src/sys/sgx/ext/io.rs)0
-rw-r--r--library/std/src/os/fortanix_sgx/mod.rs6
-rw-r--r--library/std/src/os/hermit/ffi.rs (renamed from library/std/src/sys/hermit/ext/ffi.rs)0
-rw-r--r--library/std/src/os/hermit/mod.rs (renamed from library/std/src/sys/hermit/ext/mod.rs)1
-rw-r--r--library/std/src/os/linux/mod.rs1
-rw-r--r--library/std/src/os/linux/raw.rs1
-rw-r--r--library/std/src/os/mod.rs169
-rw-r--r--library/std/src/os/redox/raw.rs1
-rw-r--r--library/std/src/os/unix/ffi.rs (renamed from library/std/src/sys/unix/ext/ffi.rs)0
-rw-r--r--library/std/src/os/unix/fs.rs (renamed from library/std/src/sys/unix/ext/fs.rs)0
-rw-r--r--library/std/src/os/unix/io.rs (renamed from library/std/src/sys/unix/ext/io.rs)0
-rw-r--r--library/std/src/os/unix/mod.rs (renamed from library/std/src/sys/unix/ext/mod.rs)73
-rw-r--r--library/std/src/os/unix/net/addr.rs (renamed from library/std/src/sys/unix/ext/net/addr.rs)0
-rw-r--r--library/std/src/os/unix/net/ancillary.rs (renamed from library/std/src/sys/unix/ext/net/ancillary.rs)0
-rw-r--r--library/std/src/os/unix/net/datagram.rs (renamed from library/std/src/sys/unix/ext/net/datagram.rs)0
-rw-r--r--library/std/src/os/unix/net/listener.rs (renamed from library/std/src/sys/unix/ext/net/listener.rs)0
-rw-r--r--library/std/src/os/unix/net/mod.rs (renamed from library/std/src/sys/unix/ext/net/mod.rs)0
-rw-r--r--library/std/src/os/unix/net/raw_fd.rs (renamed from library/std/src/sys/unix/ext/net/raw_fd.rs)0
-rw-r--r--library/std/src/os/unix/net/stream.rs (renamed from library/std/src/sys/unix/ext/net/stream.rs)0
-rw-r--r--library/std/src/os/unix/net/tests.rs (renamed from library/std/src/sys/unix/ext/net/tests.rs)0
-rw-r--r--library/std/src/os/unix/process.rs (renamed from library/std/src/sys/unix/ext/process.rs)0
-rw-r--r--library/std/src/os/unix/raw.rs (renamed from library/std/src/sys/unix/ext/raw.rs)0
-rw-r--r--library/std/src/os/unix/thread.rs (renamed from library/std/src/sys/unix/ext/thread.rs)0
-rw-r--r--library/std/src/os/unix/ucred.rs (renamed from library/std/src/sys/unix/ext/ucred.rs)0
-rw-r--r--library/std/src/os/unix/ucred/tests.rs (renamed from library/std/src/sys/unix/ext/ucred/tests.rs)0
-rw-r--r--library/std/src/os/wasi.rs6
-rw-r--r--library/std/src/os/wasi/ffi.rs (renamed from library/std/src/sys/wasi/ext/ffi.rs)0
-rw-r--r--library/std/src/os/wasi/fs.rs (renamed from library/std/src/sys/wasi/ext/fs.rs)0
-rw-r--r--library/std/src/os/wasi/io.rs (renamed from library/std/src/sys/wasi/ext/io.rs)0
-rw-r--r--library/std/src/os/wasi/mod.rs (renamed from library/std/src/sys/wasi/ext/mod.rs)1
-rw-r--r--library/std/src/os/windows/ffi.rs (renamed from library/std/src/sys/windows/ext/ffi.rs)0
-rw-r--r--library/std/src/os/windows/fs.rs (renamed from library/std/src/sys/windows/ext/fs.rs)0
-rw-r--r--library/std/src/os/windows/io.rs (renamed from library/std/src/sys/windows/ext/io.rs)0
-rw-r--r--library/std/src/os/windows/mod.rs (renamed from library/std/src/sys/windows/ext/mod.rs)1
-rw-r--r--library/std/src/os/windows/process.rs (renamed from library/std/src/sys/windows/ext/process.rs)0
-rw-r--r--library/std/src/os/windows/raw.rs (renamed from library/std/src/sys/windows/ext/raw.rs)0
-rw-r--r--library/std/src/os/windows/thread.rs (renamed from library/std/src/sys/windows/ext/thread.rs)0
-rw-r--r--library/std/src/sys/hermit/mod.rs1
-rw-r--r--library/std/src/sys/mod.rs81
-rw-r--r--library/std/src/sys/sgx/ext/mod.rs5
-rw-r--r--library/std/src/sys/sgx/mod.rs1
-rw-r--r--library/std/src/sys/unix/mod.rs1
-rw-r--r--library/std/src/sys/wasi/mod.rs1
-rw-r--r--library/std/src/sys/windows/mod.rs1
46 files changed, 161 insertions, 190 deletions
diff --git a/library/std/src/sys/sgx/ext/arch.rs b/library/std/src/os/fortanix_sgx/arch.rs
index b0170e67446..b0170e67446 100644
--- a/library/std/src/sys/sgx/ext/arch.rs
+++ b/library/std/src/os/fortanix_sgx/arch.rs
diff --git a/library/std/src/sys/sgx/ext/ffi.rs b/library/std/src/os/fortanix_sgx/ffi.rs
index 63fc5ff2866..63fc5ff2866 100644
--- a/library/std/src/sys/sgx/ext/ffi.rs
+++ b/library/std/src/os/fortanix_sgx/ffi.rs
diff --git a/library/std/src/sys/sgx/ext/io.rs b/library/std/src/os/fortanix_sgx/io.rs
index 7223ade6815..7223ade6815 100644
--- a/library/std/src/sys/sgx/ext/io.rs
+++ b/library/std/src/os/fortanix_sgx/io.rs
diff --git a/library/std/src/os/fortanix_sgx/mod.rs b/library/std/src/os/fortanix_sgx/mod.rs
index 69923268e57..a40dabe190a 100644
--- a/library/std/src/os/fortanix_sgx/mod.rs
+++ b/library/std/src/os/fortanix_sgx/mod.rs
@@ -3,7 +3,7 @@
 //! This includes functions to deal with memory isolation, usercalls, and the
 //! SGX instruction set.
 
-#![deny(missing_docs, missing_debug_implementations)]
+#![deny(missing_docs)]
 #![unstable(feature = "sgx_platform", issue = "56975")]
 
 /// Low-level interfaces to usercalls. See the [ABI documentation] for more
@@ -43,7 +43,9 @@ pub mod mem {
     pub use crate::sys::abi::mem::*;
 }
 
-pub use crate::sys::ext::{arch, ffi, io};
+pub mod arch;
+pub mod ffi;
+pub mod io;
 
 /// Functions for querying thread-related information.
 pub mod thread {
diff --git a/library/std/src/sys/hermit/ext/ffi.rs b/library/std/src/os/hermit/ffi.rs
index 07b59a02556..07b59a02556 100644
--- a/library/std/src/sys/hermit/ext/ffi.rs
+++ b/library/std/src/os/hermit/ffi.rs
diff --git a/library/std/src/sys/hermit/ext/mod.rs b/library/std/src/os/hermit/mod.rs
index ea87d0ad2c9..4657b545a1b 100644
--- a/library/std/src/sys/hermit/ext/mod.rs
+++ b/library/std/src/os/hermit/mod.rs
@@ -1,5 +1,4 @@
 #![stable(feature = "rust1", since = "1.0.0")]
-#![allow(missing_docs)]
 
 pub mod ffi;
 
diff --git a/library/std/src/os/linux/mod.rs b/library/std/src/os/linux/mod.rs
index f179a524336..94438defc22 100644
--- a/library/std/src/os/linux/mod.rs
+++ b/library/std/src/os/linux/mod.rs
@@ -1,6 +1,7 @@
 //! Linux-specific definitions.
 
 #![stable(feature = "raw_ext", since = "1.1.0")]
+#![doc(cfg(target_os = "linux"))]
 
 pub mod fs;
 pub mod raw;
diff --git a/library/std/src/os/linux/raw.rs b/library/std/src/os/linux/raw.rs
index 525102212c4..5b68a7e1262 100644
--- a/library/std/src/os/linux/raw.rs
+++ b/library/std/src/os/linux/raw.rs
@@ -9,7 +9,6 @@
               definitions"
 )]
 #![allow(deprecated)]
-#![allow(missing_debug_implementations)]
 
 use crate::os::raw::c_ulong;
 
diff --git a/library/std/src/os/mod.rs b/library/std/src/os/mod.rs
index b95511e43d8..07e29ebf368 100644
--- a/library/std/src/os/mod.rs
+++ b/library/std/src/os/mod.rs
@@ -3,78 +3,119 @@
 #![stable(feature = "os", since = "1.0.0")]
 #![allow(missing_docs, nonstandard_style, missing_debug_implementations)]
 
-// When documenting libstd we want to show unix/windows/linux/wasi modules as these are the "main
-// modules" that are used across platforms, so all modules are enabled when `cfg(doc)` is set.
-// This should help show platform-specific functionality in a hopefully cross-platform way in the
-// documentation.
-// Note that we deliberately avoid `cfg_if!` here to work around a rust-analyzer bug that would make
-// `std::os` submodules unusable: https://github.com/rust-analyzer/rust-analyzer/issues/6038
+pub mod raw;
 
-#[cfg(doc)]
-#[stable(feature = "rust1", since = "1.0.0")]
-pub use crate::sys::unix_ext as unix;
+// The code below could be written clearer using `cfg_if!`. However, the items below are
+// publicly exported by `std` and external tools can have trouble analysing them because of the use
+// of a macro that is not vendored by Rust and included in the toolchain.
+// See https://github.com/rust-analyzer/rust-analyzer/issues/6038.
 
-#[cfg(doc)]
-#[stable(feature = "rust1", since = "1.0.0")]
-pub use crate::sys::windows_ext as windows;
+#[cfg(all(
+    doc,
+    not(any(
+        all(target_arch = "wasm32", not(target_os = "wasi")),
+        all(target_vendor = "fortanix", target_env = "sgx")
+    ))
+))]
+#[path = "."]
+mod doc {
+    // When documenting std we want to show the `unix`, `windows`, `linux` and `wasi`
+    // modules as these are the "main modules" that are used across platforms,
+    // so these modules are enabled when `cfg(doc)` is set.
+    // This should help show platform-specific functionality in a hopefully cross-platform
+    // way in the documentation.
 
-#[cfg(doc)]
-#[doc(cfg(target_os = "linux"))]
-pub mod linux;
+    pub mod unix;
 
-#[cfg(doc)]
-#[stable(feature = "wasi_ext_doc", since = "1.35.0")]
-pub use crate::sys::wasi_ext as wasi;
+    pub mod linux;
 
-// If we're not documenting libstd then we just expose the main modules as we otherwise would.
+    pub mod wasi;
 
-#[cfg(not(doc))]
-#[cfg(any(unix, target_os = "hermit"))]
-#[stable(feature = "rust1", since = "1.0.0")]
-pub use crate::sys::ext as unix;
+    pub mod windows;
+}
+#[cfg(all(
+    doc,
+    any(
+        all(target_arch = "wasm32", not(target_os = "wasi")),
+        all(target_vendor = "fortanix", target_env = "sgx")
+    )
+))]
+mod doc {
+    // On certain platforms right now the "main modules" modules that are
+    // documented don't compile (missing things in `libc` which is empty),
+    // so just omit them with an empty module.
 
-#[cfg(not(doc))]
-#[cfg(windows)]
-#[stable(feature = "rust1", since = "1.0.0")]
-pub use crate::sys::ext as windows;
+    #[unstable(issue = "none", feature = "std_internals")]
+    pub mod unix {}
 
-#[cfg(not(doc))]
-#[cfg(any(target_os = "linux", target_os = "l4re"))]
-pub mod linux;
+    #[unstable(issue = "none", feature = "std_internals")]
+    pub mod linux {}
+
+    #[unstable(issue = "none", feature = "std_internals")]
+    pub mod wasi {}
+
+    #[unstable(issue = "none", feature = "std_internals")]
+    pub mod windows {}
+}
+#[cfg(doc)]
+#[stable(feature = "os", since = "1.0.0")]
+pub use doc::*;
 
 #[cfg(not(doc))]
-#[cfg(target_os = "wasi")]
-pub mod wasi;
-
-#[cfg(target_os = "android")]
-pub mod android;
-#[cfg(target_os = "dragonfly")]
-pub mod dragonfly;
-#[cfg(target_os = "emscripten")]
-pub mod emscripten;
-#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
-pub mod fortanix_sgx;
-#[cfg(target_os = "freebsd")]
-pub mod freebsd;
-#[cfg(target_os = "fuchsia")]
-pub mod fuchsia;
-#[cfg(target_os = "haiku")]
-pub mod haiku;
-#[cfg(target_os = "illumos")]
-pub mod illumos;
-#[cfg(target_os = "ios")]
-pub mod ios;
-#[cfg(target_os = "macos")]
-pub mod macos;
-#[cfg(target_os = "netbsd")]
-pub mod netbsd;
-#[cfg(target_os = "openbsd")]
-pub mod openbsd;
-#[cfg(target_os = "redox")]
-pub mod redox;
-#[cfg(target_os = "solaris")]
-pub mod solaris;
-#[cfg(target_os = "vxworks")]
-pub mod vxworks;
+#[path = "."]
+mod imp {
+    // If we're not documenting std then we only expose modules appropriate for the
+    // current platform.
 
-pub mod raw;
+    #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
+    pub mod fortanix_sgx;
+
+    #[cfg(target_os = "hermit")]
+    #[path = "hermit/mod.rs"]
+    pub mod unix;
+
+    #[cfg(target_os = "android")]
+    pub mod android;
+    #[cfg(target_os = "dragonfly")]
+    pub mod dragonfly;
+    #[cfg(target_os = "emscripten")]
+    pub mod emscripten;
+    #[cfg(target_os = "freebsd")]
+    pub mod freebsd;
+    #[cfg(target_os = "fuchsia")]
+    pub mod fuchsia;
+    #[cfg(target_os = "haiku")]
+    pub mod haiku;
+    #[cfg(target_os = "illumos")]
+    pub mod illumos;
+    #[cfg(target_os = "ios")]
+    pub mod ios;
+    #[cfg(target_os = "l4re")]
+    pub mod linux;
+    #[cfg(target_os = "linux")]
+    pub mod linux;
+    #[cfg(target_os = "macos")]
+    pub mod macos;
+    #[cfg(target_os = "netbsd")]
+    pub mod netbsd;
+    #[cfg(target_os = "openbsd")]
+    pub mod openbsd;
+    #[cfg(target_os = "redox")]
+    pub mod redox;
+    #[cfg(target_os = "solaris")]
+    pub mod solaris;
+    #[cfg(unix)]
+    pub mod unix;
+
+    #[cfg(target_os = "vxworks")]
+    pub mod vxworks;
+
+    #[cfg(target_os = "wasi")]
+    pub mod wasi;
+
+    #[cfg(windows)]
+    pub mod windows;
+}
+#[cfg(not(doc))]
+#[stable(feature = "os", since = "1.0.0")]
+pub use imp::*;
diff --git a/library/std/src/os/redox/raw.rs b/library/std/src/os/redox/raw.rs
index abe6dfc6b0c..9a6b99684c5 100644
--- a/library/std/src/os/redox/raw.rs
+++ b/library/std/src/os/redox/raw.rs
@@ -9,7 +9,6 @@
               definitions"
 )]
 #![allow(deprecated)]
-#![allow(missing_debug_implementations)]
 
 use crate::os::raw::{c_char, c_int, c_long, c_ulong, c_void};
 
diff --git a/library/std/src/sys/unix/ext/ffi.rs b/library/std/src/os/unix/ffi.rs
index 123f85deaf9..123f85deaf9 100644
--- a/library/std/src/sys/unix/ext/ffi.rs
+++ b/library/std/src/os/unix/ffi.rs
diff --git a/library/std/src/sys/unix/ext/fs.rs b/library/std/src/os/unix/fs.rs
index 9cf51be2836..9cf51be2836 100644
--- a/library/std/src/sys/unix/ext/fs.rs
+++ b/library/std/src/os/unix/fs.rs
diff --git a/library/std/src/sys/unix/ext/io.rs b/library/std/src/os/unix/io.rs
index 07c30bfa9ed..07c30bfa9ed 100644
--- a/library/std/src/sys/unix/ext/io.rs
+++ b/library/std/src/os/unix/io.rs
diff --git a/library/std/src/sys/unix/ext/mod.rs b/library/std/src/os/unix/mod.rs
index 735bf35a3ce..6fc1c89a2ba 100644
--- a/library/std/src/sys/unix/ext/mod.rs
+++ b/library/std/src/os/unix/mod.rs
@@ -27,44 +27,43 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(cfg(unix))]
-#![allow(missing_docs)]
 
-cfg_if::cfg_if! {
-    if #[cfg(doc)] {
-        // Use linux as the default platform when documenting on other platforms like Windows
-        use crate::os::linux as platform;
-    } else {
-        #[cfg(target_os = "android")]
-        use crate::os::android as platform;
-        #[cfg(target_os = "dragonfly")]
-        use crate::os::dragonfly as platform;
-        #[cfg(target_os = "emscripten")]
-        use crate::os::emscripten as platform;
-        #[cfg(target_os = "freebsd")]
-        use crate::os::freebsd as platform;
-        #[cfg(target_os = "fuchsia")]
-        use crate::os::fuchsia as platform;
-        #[cfg(target_os = "haiku")]
-        use crate::os::haiku as platform;
-        #[cfg(target_os = "illumos")]
-        use crate::os::illumos as platform;
-        #[cfg(target_os = "ios")]
-        use crate::os::ios as platform;
-        #[cfg(any(target_os = "linux", target_os = "l4re"))]
-        use crate::os::linux as platform;
-        #[cfg(target_os = "macos")]
-        use crate::os::macos as platform;
-        #[cfg(target_os = "netbsd")]
-        use crate::os::netbsd as platform;
-        #[cfg(target_os = "openbsd")]
-        use crate::os::openbsd as platform;
-        #[cfg(target_os = "redox")]
-        use crate::os::redox as platform;
-        #[cfg(target_os = "solaris")]
-        use crate::os::solaris as platform;
-        #[cfg(target_os = "vxworks")]
-        use crate::os::vxworks as platform;
-    }
+// Use linux as the default platform when documenting on other platforms like Windows
+#[cfg(doc)]
+use crate::os::linux as platform;
+
+#[cfg(not(doc))]
+mod platform {
+    #[cfg(target_os = "android")]
+    pub use crate::os::android::*;
+    #[cfg(target_os = "dragonfly")]
+    pub use crate::os::dragonfly::*;
+    #[cfg(target_os = "emscripten")]
+    pub use crate::os::emscripten::*;
+    #[cfg(target_os = "freebsd")]
+    pub use crate::os::freebsd::*;
+    #[cfg(target_os = "fuchsia")]
+    pub use crate::os::fuchsia::*;
+    #[cfg(target_os = "haiku")]
+    pub use crate::os::haiku::*;
+    #[cfg(target_os = "illumos")]
+    pub use crate::os::illumos::*;
+    #[cfg(target_os = "ios")]
+    pub use crate::os::ios::*;
+    #[cfg(any(target_os = "linux", target_os = "l4re"))]
+    pub use crate::os::linux::*;
+    #[cfg(target_os = "macos")]
+    pub use crate::os::macos::*;
+    #[cfg(target_os = "netbsd")]
+    pub use crate::os::netbsd::*;
+    #[cfg(target_os = "openbsd")]
+    pub use crate::os::openbsd::*;
+    #[cfg(target_os = "redox")]
+    pub use crate::os::redox::*;
+    #[cfg(target_os = "solaris")]
+    pub use crate::os::solaris::*;
+    #[cfg(target_os = "vxworks")]
+    pub use crate::os::vxworks::*;
 }
 
 pub mod ffi;
diff --git a/library/std/src/sys/unix/ext/net/addr.rs b/library/std/src/os/unix/net/addr.rs
index 459f3590e64..459f3590e64 100644
--- a/library/std/src/sys/unix/ext/net/addr.rs
+++ b/library/std/src/os/unix/net/addr.rs
diff --git a/library/std/src/sys/unix/ext/net/ancillary.rs b/library/std/src/os/unix/net/ancillary.rs
index 15ce7056fea..15ce7056fea 100644
--- a/library/std/src/sys/unix/ext/net/ancillary.rs
+++ b/library/std/src/os/unix/net/ancillary.rs
diff --git a/library/std/src/sys/unix/ext/net/datagram.rs b/library/std/src/os/unix/net/datagram.rs
index 9e39f70f68e..9e39f70f68e 100644
--- a/library/std/src/sys/unix/ext/net/datagram.rs
+++ b/library/std/src/os/unix/net/datagram.rs
diff --git a/library/std/src/sys/unix/ext/net/listener.rs b/library/std/src/os/unix/net/listener.rs
index bdd08fe8380..bdd08fe8380 100644
--- a/library/std/src/sys/unix/ext/net/listener.rs
+++ b/library/std/src/os/unix/net/listener.rs
diff --git a/library/std/src/sys/unix/ext/net/mod.rs b/library/std/src/os/unix/net/mod.rs
index 3088ffb5e5c..3088ffb5e5c 100644
--- a/library/std/src/sys/unix/ext/net/mod.rs
+++ b/library/std/src/os/unix/net/mod.rs
diff --git a/library/std/src/sys/unix/ext/net/raw_fd.rs b/library/std/src/os/unix/net/raw_fd.rs
index b3f12844101..b3f12844101 100644
--- a/library/std/src/sys/unix/ext/net/raw_fd.rs
+++ b/library/std/src/os/unix/net/raw_fd.rs
diff --git a/library/std/src/sys/unix/ext/net/stream.rs b/library/std/src/os/unix/net/stream.rs
index a6f6e091305..a6f6e091305 100644
--- a/library/std/src/sys/unix/ext/net/stream.rs
+++ b/library/std/src/os/unix/net/stream.rs
diff --git a/library/std/src/sys/unix/ext/net/tests.rs b/library/std/src/os/unix/net/tests.rs
index bd9b6dd727b..bd9b6dd727b 100644
--- a/library/std/src/sys/unix/ext/net/tests.rs
+++ b/library/std/src/os/unix/net/tests.rs
diff --git a/library/std/src/sys/unix/ext/process.rs b/library/std/src/os/unix/process.rs
index 355855bcd10..355855bcd10 100644
--- a/library/std/src/sys/unix/ext/process.rs
+++ b/library/std/src/os/unix/process.rs
diff --git a/library/std/src/sys/unix/ext/raw.rs b/library/std/src/os/unix/raw.rs
index c292955cb4e..c292955cb4e 100644
--- a/library/std/src/sys/unix/ext/raw.rs
+++ b/library/std/src/os/unix/raw.rs
diff --git a/library/std/src/sys/unix/ext/thread.rs b/library/std/src/os/unix/thread.rs
index 7221da1a9a7..7221da1a9a7 100644
--- a/library/std/src/sys/unix/ext/thread.rs
+++ b/library/std/src/os/unix/thread.rs
diff --git a/library/std/src/sys/unix/ext/ucred.rs b/library/std/src/os/unix/ucred.rs
index 1b4c18d3d84..1b4c18d3d84 100644
--- a/library/std/src/sys/unix/ext/ucred.rs
+++ b/library/std/src/os/unix/ucred.rs
diff --git a/library/std/src/sys/unix/ext/ucred/tests.rs b/library/std/src/os/unix/ucred/tests.rs
index 42d79418cf7..42d79418cf7 100644
--- a/library/std/src/sys/unix/ext/ucred/tests.rs
+++ b/library/std/src/os/unix/ucred/tests.rs
diff --git a/library/std/src/os/wasi.rs b/library/std/src/os/wasi.rs
deleted file mode 100644
index d25b8d39ed6..00000000000
--- a/library/std/src/os/wasi.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//! WASI-specific definitions
-
-#![stable(feature = "raw_ext", since = "1.1.0")]
-
-#[stable(feature = "rust1", since = "1.0.0")]
-pub use crate::sys::ext::*;
diff --git a/library/std/src/sys/wasi/ext/ffi.rs b/library/std/src/os/wasi/ffi.rs
index f71f316d1ba..f71f316d1ba 100644
--- a/library/std/src/sys/wasi/ext/ffi.rs
+++ b/library/std/src/os/wasi/ffi.rs
diff --git a/library/std/src/sys/wasi/ext/fs.rs b/library/std/src/os/wasi/fs.rs
index ba4057bd34c..ba4057bd34c 100644
--- a/library/std/src/sys/wasi/ext/fs.rs
+++ b/library/std/src/os/wasi/fs.rs
diff --git a/library/std/src/sys/wasi/ext/io.rs b/library/std/src/os/wasi/io.rs
index b2e79cc1b4a..b2e79cc1b4a 100644
--- a/library/std/src/sys/wasi/ext/io.rs
+++ b/library/std/src/os/wasi/io.rs
diff --git a/library/std/src/sys/wasi/ext/mod.rs b/library/std/src/os/wasi/mod.rs
index b08402f0776..66edb953677 100644
--- a/library/std/src/sys/wasi/ext/mod.rs
+++ b/library/std/src/os/wasi/mod.rs
@@ -25,6 +25,7 @@
 //! }
 //! ```
 
+#![stable(feature = "rust1", since = "1.0.0")]
 #![deny(unsafe_op_in_unsafe_fn)]
 #![doc(cfg(target_os = "wasi"))]
 
diff --git a/library/std/src/sys/windows/ext/ffi.rs b/library/std/src/os/windows/ffi.rs
index c89b9ff1efa..c89b9ff1efa 100644
--- a/library/std/src/sys/windows/ext/ffi.rs
+++ b/library/std/src/os/windows/ffi.rs
diff --git a/library/std/src/sys/windows/ext/fs.rs b/library/std/src/os/windows/fs.rs
index b20eafb4d53..b20eafb4d53 100644
--- a/library/std/src/sys/windows/ext/fs.rs
+++ b/library/std/src/os/windows/fs.rs
diff --git a/library/std/src/sys/windows/ext/io.rs b/library/std/src/os/windows/io.rs
index 31b5d015ed0..31b5d015ed0 100644
--- a/library/std/src/sys/windows/ext/io.rs
+++ b/library/std/src/os/windows/io.rs
diff --git a/library/std/src/sys/windows/ext/mod.rs b/library/std/src/os/windows/mod.rs
index 613d3dc189a..52ac508f9f7 100644
--- a/library/std/src/sys/windows/ext/mod.rs
+++ b/library/std/src/os/windows/mod.rs
@@ -8,7 +8,6 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 #![doc(cfg(windows))]
-#![allow(missing_docs)]
 
 pub mod ffi;
 pub mod fs;
diff --git a/library/std/src/sys/windows/ext/process.rs b/library/std/src/os/windows/process.rs
index 67756b15531..67756b15531 100644
--- a/library/std/src/sys/windows/ext/process.rs
+++ b/library/std/src/os/windows/process.rs
diff --git a/library/std/src/sys/windows/ext/raw.rs b/library/std/src/os/windows/raw.rs
index 5014e008eb5..5014e008eb5 100644
--- a/library/std/src/sys/windows/ext/raw.rs
+++ b/library/std/src/os/windows/raw.rs
diff --git a/library/std/src/sys/windows/ext/thread.rs b/library/std/src/os/windows/thread.rs
index 6bd02054f71..6bd02054f71 100644
--- a/library/std/src/sys/windows/ext/thread.rs
+++ b/library/std/src/os/windows/thread.rs
diff --git a/library/std/src/sys/hermit/mod.rs b/library/std/src/sys/hermit/mod.rs
index 0c49a6fb6de..15a76bbd2c9 100644
--- a/library/std/src/sys/hermit/mod.rs
+++ b/library/std/src/sys/hermit/mod.rs
@@ -24,7 +24,6 @@ pub mod args;
 pub mod cmath;
 pub mod condvar;
 pub mod env;
-pub mod ext;
 pub mod fd;
 pub mod fs;
 #[path = "../unsupported/io.rs"]
diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs
index 2450a7aac5e..f813587b1b3 100644
--- a/library/std/src/sys/mod.rs
+++ b/library/std/src/sys/mod.rs
@@ -49,80 +49,27 @@ cfg_if::cfg_if! {
     }
 }
 
-// Import essential modules from both platforms when documenting. These are
-// then later used in the `std::os` module when documenting, for example,
-// Windows when we're compiling for Linux.
+// Import essential modules from platforms used in `std::os` when documenting.
+//
+// Note that on some platforms those modules don't compile
+// (missing things in `libc` which is empty), so they are not included in `std::os` and can be
+// omitted here as well.
 
 #[cfg(doc)]
+#[cfg(not(any(
+    all(target_arch = "wasm32", not(target_os = "wasi")),
+    all(target_vendor = "fortanix", target_env = "sgx")
+)))]
 cfg_if::cfg_if! {
-    if #[cfg(unix)] {
-        // On unix we'll document what's already available
-        #[stable(feature = "rust1", since = "1.0.0")]
-        pub use self::ext as unix_ext;
-    } else if #[cfg(any(target_os = "hermit",
-                        all(target_arch = "wasm32", not(target_os = "wasi")),
-                        all(target_vendor = "fortanix", target_env = "sgx")))] {
-        // On non-WASI wasm right now the module below doesn't compile
-        // (missing things in `libc` which is empty) so just omit everything
-        // with an empty module
-        #[unstable(issue = "none", feature = "std_internals")]
-        #[allow(missing_docs)]
-        pub mod unix_ext {}
-    } else {
-        #[path = "unix/ext/mod.rs"]
-        pub mod unix_ext;
-    }
-}
-
-#[cfg(doc)]
-cfg_if::cfg_if! {
-    if #[cfg(windows)] {
-        // On windows we'll just be documenting what's already available
-        #[allow(missing_docs)]
-        #[stable(feature = "rust1", since = "1.0.0")]
-        pub use self::ext as windows_ext;
-    } else if #[cfg(any(target_os = "hermit",
-                        all(target_arch = "wasm32", not(target_os = "wasi")),
-                        all(target_vendor = "fortanix", target_env = "sgx")))] {
-        // On non-WASI wasm right now the shim below doesn't compile, so
-        // just omit it
-        #[unstable(issue = "none", feature = "std_internals")]
-        #[allow(missing_docs)]
-        pub mod windows_ext {}
-    } else {
-        // On all other platforms (aka linux/osx/etc) then pull in a "minimal"
+    if #[cfg(not(windows))] {
+        // On non-Windows platforms (aka linux/osx/etc) pull in a "minimal"
         // amount of windows goop which ends up compiling
+
         #[macro_use]
         #[path = "windows/compat.rs"]
-        mod compat;
+        pub mod compat;
 
         #[path = "windows/c.rs"]
-        mod c;
-
-        #[path = "windows/ext/mod.rs"]
-        pub mod windows_ext;
-    }
-}
-
-#[cfg(doc)]
-cfg_if::cfg_if! {
-    if #[cfg(target_os = "wasi")] {
-        // On WASI we'll document what's already available
-        #[stable(feature = "wasi_ext_doc", since = "1.35.0")]
-        pub use self::ext as wasi_ext;
-    } else if #[cfg(any(target_os = "hermit",
-                        target_arch = "wasm32",
-                        all(target_vendor = "fortanix", target_env = "sgx")))] {
-        // On non-WASI wasm right now the module below doesn't compile
-        // (missing things in `libc` which is empty) so just omit everything
-        // with an empty module
-        #[unstable(issue = "none", feature = "std_internals")]
-        #[allow(missing_docs)]
-        pub mod wasi_ext {}
-    } else {
-        // On other platforms like Windows document the bare bones of WASI
-        #[path = "wasi/ext/mod.rs"]
-        #[stable(feature = "wasi_ext_doc", since = "1.35.0")]
-        pub mod wasi_ext;
+        pub mod c;
     }
 }
diff --git a/library/std/src/sys/sgx/ext/mod.rs b/library/std/src/sys/sgx/ext/mod.rs
deleted file mode 100644
index 258ad3cd218..00000000000
--- a/library/std/src/sys/sgx/ext/mod.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#![unstable(feature = "sgx_platform", issue = "56975")]
-
-pub mod arch;
-pub mod ffi;
-pub mod io;
diff --git a/library/std/src/sys/sgx/mod.rs b/library/std/src/sys/sgx/mod.rs
index bf3bd57e982..cdfceca19fc 100644
--- a/library/std/src/sys/sgx/mod.rs
+++ b/library/std/src/sys/sgx/mod.rs
@@ -17,7 +17,6 @@ pub mod args;
 pub mod cmath;
 pub mod condvar;
 pub mod env;
-pub mod ext;
 pub mod fd;
 #[path = "../unsupported/fs.rs"]
 pub mod fs;
diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs
index 562d9d92637..57d91441b6f 100644
--- a/library/std/src/sys/unix/mod.rs
+++ b/library/std/src/sys/unix/mod.rs
@@ -15,7 +15,6 @@ pub mod args;
 pub mod cmath;
 pub mod condvar;
 pub mod env;
-pub mod ext;
 pub mod fd;
 pub mod fs;
 pub mod futex;
diff --git a/library/std/src/sys/wasi/mod.rs b/library/std/src/sys/wasi/mod.rs
index 88b81d455d2..45a829c0cd2 100644
--- a/library/std/src/sys/wasi/mod.rs
+++ b/library/std/src/sys/wasi/mod.rs
@@ -33,7 +33,6 @@ pub mod mutex;
 pub mod net;
 pub mod os;
 pub use crate::sys_common::os_str_bytes as os_str;
-pub mod ext;
 #[path = "../unix/path.rs"]
 pub mod path;
 #[path = "../unsupported/pipe.rs"]
diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs
index 2208ff025c0..cc60ca375ea 100644
--- a/library/std/src/sys/windows/mod.rs
+++ b/library/std/src/sys/windows/mod.rs
@@ -18,7 +18,6 @@ pub mod c;
 pub mod cmath;
 pub mod condvar;
 pub mod env;
-pub mod ext;
 pub mod fs;
 pub mod handle;
 pub mod io;