about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorMads Marquart <mads@marquart.dk>2024-06-03 18:48:59 +0200
committerMads Marquart <mads@marquart.dk>2024-07-14 15:31:54 +0200
commit306d5788a684e71cc5dc03c71da3b2e26672b6a3 (patch)
tree172f8575ef53f68e7a5c270d9e5d5a93462aca10 /library/std
parentbcf94dec5ba6838e435902120c0384c360126a26 (diff)
downloadrust-306d5788a684e71cc5dc03c71da3b2e26672b6a3.tar.gz
rust-306d5788a684e71cc5dc03c71da3b2e26672b6a3.zip
Merge Apple `std::os` extensions modules into `std::os::darwin`
The functionality available on Apple platforms are very similar, and
were duplicated for each platform.

Additionally, this fixes a warning when compiling the standard library
for tvOS, watchOS and visionOS by marking the corresponding code as
dead code.
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/fs/tests.rs23
-rw-r--r--library/std/src/os/darwin/fs.rs (renamed from library/std/src/os/macos/fs.rs)6
-rw-r--r--library/std/src/os/darwin/mod.rs20
-rw-r--r--library/std/src/os/darwin/raw.rs (renamed from library/std/src/os/ios/raw.rs)14
-rw-r--r--library/std/src/os/ios/fs.rs160
-rw-r--r--library/std/src/os/ios/mod.rs28
-rw-r--r--library/std/src/os/macos/mod.rs28
-rw-r--r--library/std/src/os/macos/raw.rs83
-rw-r--r--library/std/src/os/mod.rs11
-rw-r--r--library/std/src/os/unix/mod.rs12
-rw-r--r--library/std/src/os/visionos/fs.rs160
-rw-r--r--library/std/src/os/visionos/mod.rs6
-rw-r--r--library/std/src/os/visionos/raw.rs83
-rw-r--r--library/std/src/os/watchos/fs.rs160
-rw-r--r--library/std/src/os/watchos/mod.rs6
-rw-r--r--library/std/src/os/watchos/raw.rs83
16 files changed, 86 insertions, 797 deletions
diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs
index 62a268facb6..f1749efdfa9 100644
--- a/library/std/src/fs/tests.rs
+++ b/library/std/src/fs/tests.rs
@@ -1638,16 +1638,8 @@ fn rename_directory() {
 
 #[test]
 fn test_file_times() {
-    #[cfg(target_os = "ios")]
-    use crate::os::ios::fs::FileTimesExt;
-    #[cfg(target_os = "macos")]
-    use crate::os::macos::fs::FileTimesExt;
-    #[cfg(target_os = "tvos")]
-    use crate::os::tvos::fs::FileTimesExt;
-    #[cfg(target_os = "visionos")]
-    use crate::os::visionos::fs::FileTimesExt;
-    #[cfg(target_os = "watchos")]
-    use crate::os::watchos::fs::FileTimesExt;
+    #[cfg(target_vendor = "apple")]
+    use crate::os::darwin::fs::FileTimesExt;
     #[cfg(windows)]
     use crate::os::windows::fs::FileTimesExt;
 
@@ -1693,16 +1685,7 @@ fn test_file_times() {
 #[test]
 #[cfg(target_vendor = "apple")]
 fn test_file_times_pre_epoch_with_nanos() {
-    #[cfg(target_os = "ios")]
-    use crate::os::ios::fs::FileTimesExt;
-    #[cfg(target_os = "macos")]
-    use crate::os::macos::fs::FileTimesExt;
-    #[cfg(target_os = "tvos")]
-    use crate::os::tvos::fs::FileTimesExt;
-    #[cfg(target_os = "visionos")]
-    use crate::os::visionos::fs::FileTimesExt;
-    #[cfg(target_os = "watchos")]
-    use crate::os::watchos::fs::FileTimesExt;
+    use crate::os::darwin::fs::FileTimesExt;
 
     let tmp = tmpdir();
     let file = File::create(tmp.join("foo")).unwrap();
diff --git a/library/std/src/os/macos/fs.rs b/library/std/src/os/darwin/fs.rs
index 573426d1a86..2032cca311a 100644
--- a/library/std/src/os/macos/fs.rs
+++ b/library/std/src/os/darwin/fs.rs
@@ -1,4 +1,4 @@
-#![stable(feature = "metadata_ext", since = "1.1.0")]
+#![allow(dead_code)]
 
 use crate::fs::{self, Metadata};
 use crate::sealed::Sealed;
@@ -6,7 +6,7 @@ use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
 use crate::time::SystemTime;
 
 #[allow(deprecated)]
-use crate::os::macos::raw;
+use super::raw;
 
 /// OS-specific extensions to [`fs::Metadata`].
 ///
@@ -70,6 +70,7 @@ pub trait MetadataExt {
     fn st_gen(&self) -> u32;
     #[stable(feature = "metadata_ext2", since = "1.8.0")]
     fn st_lspare(&self) -> u32;
+    #[cfg(target_os = "macos")]
     #[stable(feature = "metadata_ext2", since = "1.8.0")]
     fn st_qspare(&self) -> [u64; 2];
 }
@@ -143,6 +144,7 @@ impl MetadataExt for Metadata {
     fn st_lspare(&self) -> u32 {
         self.as_inner().as_inner().st_lspare as u32
     }
+    #[cfg(target_os = "macos")]
     fn st_qspare(&self) -> [u64; 2] {
         let qspare = self.as_inner().as_inner().st_qspare;
         [qspare[0] as u64, qspare[1] as u64]
diff --git a/library/std/src/os/darwin/mod.rs b/library/std/src/os/darwin/mod.rs
new file mode 100644
index 00000000000..03401fe8895
--- /dev/null
+++ b/library/std/src/os/darwin/mod.rs
@@ -0,0 +1,20 @@
+//! Platform-specific extensions to `std` for Darwin / Apple platforms.
+//!
+//! This is available on the following operating systems:
+//! - macOS
+//! - iOS
+//! - tvOS
+//! - watchOS
+//! - visionOS
+//!
+//! Note: This module is called "Darwin" as that's the name of the underlying
+//! core OS of the above operating systems, but it should not be confused with
+//! the `-darwin` suffix in the `x86_64-apple-darwin` and
+//! `aarch64-apple-darwin` target names, which are mostly named that way for
+//! legacy reasons.
+
+pub(crate) mod fs;
+// deprecated, but used for public reexport under `std::os::unix::raw`, as
+// well as `std::os::macos`/`std::os::ios`, because those modules precede the
+// decision to remove these.
+pub(super) mod raw;
diff --git a/library/std/src/os/ios/raw.rs b/library/std/src/os/darwin/raw.rs
index af12aeebe5d..047727f4532 100644
--- a/library/std/src/os/ios/raw.rs
+++ b/library/std/src/os/darwin/raw.rs
@@ -1,15 +1,4 @@
-//! iOS-specific raw type definitions
-
-#![stable(feature = "raw_ext", since = "1.1.0")]
-#![deprecated(
-    since = "1.8.0",
-    note = "these type aliases are no longer supported by \
-            the standard library, the `libc` crate on \
-            crates.io should be used instead for the correct \
-            definitions"
-)]
-#![allow(deprecated)]
-
+//! Apple-specific raw type definitions
 use crate::os::raw::c_long;
 
 #[stable(feature = "raw_ext", since = "1.1.0")]
@@ -35,6 +24,7 @@ pub type pthread_t = usize;
 #[repr(C)]
 #[derive(Clone)]
 #[stable(feature = "raw_ext", since = "1.1.0")]
+#[allow(dead_code)]
 pub struct stat {
     #[stable(feature = "raw_ext", since = "1.1.0")]
     pub st_dev: i32,
diff --git a/library/std/src/os/ios/fs.rs b/library/std/src/os/ios/fs.rs
deleted file mode 100644
index e5df4de0b7f..00000000000
--- a/library/std/src/os/ios/fs.rs
+++ /dev/null
@@ -1,160 +0,0 @@
-#![stable(feature = "metadata_ext", since = "1.1.0")]
-
-use crate::fs::{self, Metadata};
-use crate::sealed::Sealed;
-use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
-use crate::time::SystemTime;
-
-#[allow(deprecated)]
-use super::raw;
-
-/// OS-specific extensions to [`fs::Metadata`].
-///
-/// [`fs::Metadata`]: crate::fs::Metadata
-#[stable(feature = "metadata_ext", since = "1.1.0")]
-pub trait MetadataExt {
-    /// Gain a reference to the underlying `stat` structure which contains
-    /// the raw information returned by the OS.
-    ///
-    /// The contents of the returned `stat` are **not** consistent across
-    /// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
-    /// cross-Unix abstractions contained within the raw stat.
-    #[stable(feature = "metadata_ext", since = "1.1.0")]
-    #[deprecated(
-        since = "1.8.0",
-        note = "deprecated in favor of the accessor \
-                methods of this trait"
-    )]
-    #[allow(deprecated)]
-    fn as_raw_stat(&self) -> &raw::stat;
-
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_dev(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_ino(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_mode(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_nlink(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_uid(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_gid(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_rdev(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_size(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_atime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_atime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_mtime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_mtime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_ctime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_ctime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_birthtime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_birthtime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_blksize(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_blocks(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_flags(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_gen(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_lspare(&self) -> u32;
-}
-
-#[stable(feature = "metadata_ext", since = "1.1.0")]
-impl MetadataExt for Metadata {
-    #[allow(deprecated)]
-    fn as_raw_stat(&self) -> &raw::stat {
-        unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
-    }
-    fn st_dev(&self) -> u64 {
-        self.as_inner().as_inner().st_dev as u64
-    }
-    fn st_ino(&self) -> u64 {
-        self.as_inner().as_inner().st_ino as u64
-    }
-    fn st_mode(&self) -> u32 {
-        self.as_inner().as_inner().st_mode as u32
-    }
-    fn st_nlink(&self) -> u64 {
-        self.as_inner().as_inner().st_nlink as u64
-    }
-    fn st_uid(&self) -> u32 {
-        self.as_inner().as_inner().st_uid as u32
-    }
-    fn st_gid(&self) -> u32 {
-        self.as_inner().as_inner().st_gid as u32
-    }
-    fn st_rdev(&self) -> u64 {
-        self.as_inner().as_inner().st_rdev as u64
-    }
-    fn st_size(&self) -> u64 {
-        self.as_inner().as_inner().st_size as u64
-    }
-    fn st_atime(&self) -> i64 {
-        self.as_inner().as_inner().st_atime as i64
-    }
-    fn st_atime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_atime_nsec as i64
-    }
-    fn st_mtime(&self) -> i64 {
-        self.as_inner().as_inner().st_mtime as i64
-    }
-    fn st_mtime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_mtime_nsec as i64
-    }
-    fn st_ctime(&self) -> i64 {
-        self.as_inner().as_inner().st_ctime as i64
-    }
-    fn st_ctime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_ctime_nsec as i64
-    }
-    fn st_birthtime(&self) -> i64 {
-        self.as_inner().as_inner().st_birthtime as i64
-    }
-    fn st_birthtime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_birthtime_nsec as i64
-    }
-    fn st_blksize(&self) -> u64 {
-        self.as_inner().as_inner().st_blksize as u64
-    }
-    fn st_blocks(&self) -> u64 {
-        self.as_inner().as_inner().st_blocks as u64
-    }
-    fn st_gen(&self) -> u32 {
-        self.as_inner().as_inner().st_gen as u32
-    }
-    fn st_flags(&self) -> u32 {
-        self.as_inner().as_inner().st_flags as u32
-    }
-    fn st_lspare(&self) -> u32 {
-        self.as_inner().as_inner().st_lspare as u32
-    }
-}
-
-/// OS-specific extensions to [`fs::FileTimes`].
-#[stable(feature = "file_set_times", since = "1.75.0")]
-pub trait FileTimesExt: Sealed {
-    /// Set the creation time of a file.
-    #[stable(feature = "file_set_times", since = "1.75.0")]
-    fn set_created(self, t: SystemTime) -> Self;
-}
-
-#[stable(feature = "file_set_times", since = "1.75.0")]
-impl FileTimesExt for fs::FileTimes {
-    fn set_created(mut self, t: SystemTime) -> Self {
-        self.as_inner_mut().set_created(t.into_inner());
-        self
-    }
-}
diff --git a/library/std/src/os/ios/mod.rs b/library/std/src/os/ios/mod.rs
index fdefa1f6b21..5e130d77b7b 100644
--- a/library/std/src/os/ios/mod.rs
+++ b/library/std/src/os/ios/mod.rs
@@ -2,5 +2,29 @@
 
 #![stable(feature = "raw_ext", since = "1.1.0")]
 
-pub mod fs;
-pub mod raw;
+#[stable(feature = "metadata_ext", since = "1.1.0")]
+pub mod fs {
+    #[doc(inline)]
+    #[stable(feature = "file_set_times", since = "1.75.0")]
+    pub use crate::os::darwin::fs::FileTimesExt;
+
+    #[doc(inline)]
+    #[stable(feature = "metadata_ext", since = "1.1.0")]
+    pub use crate::os::darwin::fs::MetadataExt;
+}
+
+/// iOS-specific raw type definitions
+#[stable(feature = "raw_ext", since = "1.1.0")]
+#[deprecated(
+    since = "1.8.0",
+    note = "these type aliases are no longer supported by \
+            the standard library, the `libc` crate on \
+            crates.io should be used instead for the correct \
+            definitions"
+)]
+#[allow(deprecated)]
+pub mod raw {
+    #[doc(inline)]
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub use crate::os::darwin::raw::*;
+}
diff --git a/library/std/src/os/macos/mod.rs b/library/std/src/os/macos/mod.rs
index 791d703b142..3638406b180 100644
--- a/library/std/src/os/macos/mod.rs
+++ b/library/std/src/os/macos/mod.rs
@@ -2,5 +2,29 @@
 
 #![stable(feature = "raw_ext", since = "1.1.0")]
 
-pub mod fs;
-pub mod raw;
+#[stable(feature = "metadata_ext", since = "1.1.0")]
+pub mod fs {
+    #[doc(inline)]
+    #[stable(feature = "file_set_times", since = "1.75.0")]
+    pub use crate::os::darwin::fs::FileTimesExt;
+
+    #[doc(inline)]
+    #[stable(feature = "metadata_ext", since = "1.1.0")]
+    pub use crate::os::darwin::fs::MetadataExt;
+}
+
+/// macOS-specific raw type definitions
+#[stable(feature = "raw_ext", since = "1.1.0")]
+#[deprecated(
+    since = "1.8.0",
+    note = "these type aliases are no longer supported by \
+            the standard library, the `libc` crate on \
+            crates.io should be used instead for the correct \
+            definitions"
+)]
+#[allow(deprecated)]
+pub mod raw {
+    #[doc(inline)]
+    #[stable(feature = "raw_ext", since = "1.1.0")]
+    pub use crate::os::darwin::raw::*;
+}
diff --git a/library/std/src/os/macos/raw.rs b/library/std/src/os/macos/raw.rs
deleted file mode 100644
index 0b21f6ee5e4..00000000000
--- a/library/std/src/os/macos/raw.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-//! macOS-specific raw type definitions
-
-#![stable(feature = "raw_ext", since = "1.1.0")]
-#![deprecated(
-    since = "1.8.0",
-    note = "these type aliases are no longer supported by \
-            the standard library, the `libc` crate on \
-            crates.io should be used instead for the correct \
-            definitions"
-)]
-#![allow(deprecated)]
-
-use crate::os::raw::c_long;
-
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type blkcnt_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type blksize_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type dev_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type ino_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type mode_t = u32;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type nlink_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type off_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type time_t = i64;
-
-#[stable(feature = "pthread_t", since = "1.8.0")]
-pub type pthread_t = usize;
-
-#[repr(C)]
-#[derive(Clone)]
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub struct stat {
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_dev: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_mode: u16,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_nlink: u16,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_ino: u64,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_uid: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_gid: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_rdev: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_atime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_atime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_mtime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_mtime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_ctime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_ctime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_birthtime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_birthtime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_size: i64,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_blocks: i64,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_blksize: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_flags: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_gen: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_lspare: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_qspare: [i64; 2],
-}
diff --git a/library/std/src/os/mod.rs b/library/std/src/os/mod.rs
index d2a7b316b81..455fdd3c34d 100644
--- a/library/std/src/os/mod.rs
+++ b/library/std/src/os/mod.rs
@@ -14,7 +14,7 @@ pub mod raw;
 // documented don't compile (missing things in `libc` which is empty),
 // so just omit them with an empty module and add the "unstable" attribute.
 
-// Unix, linux, wasi and windows are handled a bit differently.
+// unix, linux, wasi and windows are handled a bit differently.
 #[cfg(all(
     doc,
     any(
@@ -104,6 +104,8 @@ pub mod windows;
 pub mod aix;
 #[cfg(target_os = "android")]
 pub mod android;
+#[cfg(target_vendor = "apple")]
+pub(crate) mod darwin;
 #[cfg(target_os = "dragonfly")]
 pub mod dragonfly;
 #[cfg(target_os = "emscripten")]
@@ -144,19 +146,12 @@ pub mod redox;
 pub mod solaris;
 #[cfg(target_os = "solid_asp3")]
 pub mod solid;
-#[cfg(target_os = "tvos")]
-#[path = "ios/mod.rs"]
-pub(crate) mod tvos;
 #[cfg(target_os = "uefi")]
 pub mod uefi;
-#[cfg(target_os = "visionos")]
-pub(crate) mod visionos;
 #[cfg(target_os = "vita")]
 pub mod vita;
 #[cfg(target_os = "vxworks")]
 pub mod vxworks;
-#[cfg(target_os = "watchos")]
-pub(crate) mod watchos;
 #[cfg(target_os = "xous")]
 pub mod xous;
 
diff --git a/library/std/src/os/unix/mod.rs b/library/std/src/os/unix/mod.rs
index d7a622012a5..c6581b9c4c8 100644
--- a/library/std/src/os/unix/mod.rs
+++ b/library/std/src/os/unix/mod.rs
@@ -41,6 +41,8 @@ mod platform {
     pub use crate::os::aix::*;
     #[cfg(target_os = "android")]
     pub use crate::os::android::*;
+    #[cfg(target_vendor = "apple")]
+    pub(super) use crate::os::darwin::*;
     #[cfg(target_os = "dragonfly")]
     pub use crate::os::dragonfly::*;
     #[cfg(target_os = "emscripten")]
@@ -59,14 +61,10 @@ mod platform {
     pub use crate::os::hurd::*;
     #[cfg(target_os = "illumos")]
     pub use crate::os::illumos::*;
-    #[cfg(target_os = "ios")]
-    pub use crate::os::ios::*;
     #[cfg(target_os = "l4re")]
     pub use crate::os::l4re::*;
     #[cfg(target_os = "linux")]
     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 = "nto")]
@@ -77,16 +75,10 @@ mod platform {
     pub use crate::os::redox::*;
     #[cfg(target_os = "solaris")]
     pub use crate::os::solaris::*;
-    #[cfg(target_os = "tvos")]
-    pub use crate::os::tvos::*;
-    #[cfg(target_os = "visionos")]
-    pub use crate::os::visionos::*;
     #[cfg(target_os = "vita")]
     pub use crate::os::vita::*;
     #[cfg(target_os = "vxworks")]
     pub use crate::os::vxworks::*;
-    #[cfg(target_os = "watchos")]
-    pub use crate::os::watchos::*;
 }
 
 pub mod ffi;
diff --git a/library/std/src/os/visionos/fs.rs b/library/std/src/os/visionos/fs.rs
deleted file mode 100644
index e5df4de0b7f..00000000000
--- a/library/std/src/os/visionos/fs.rs
+++ /dev/null
@@ -1,160 +0,0 @@
-#![stable(feature = "metadata_ext", since = "1.1.0")]
-
-use crate::fs::{self, Metadata};
-use crate::sealed::Sealed;
-use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
-use crate::time::SystemTime;
-
-#[allow(deprecated)]
-use super::raw;
-
-/// OS-specific extensions to [`fs::Metadata`].
-///
-/// [`fs::Metadata`]: crate::fs::Metadata
-#[stable(feature = "metadata_ext", since = "1.1.0")]
-pub trait MetadataExt {
-    /// Gain a reference to the underlying `stat` structure which contains
-    /// the raw information returned by the OS.
-    ///
-    /// The contents of the returned `stat` are **not** consistent across
-    /// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
-    /// cross-Unix abstractions contained within the raw stat.
-    #[stable(feature = "metadata_ext", since = "1.1.0")]
-    #[deprecated(
-        since = "1.8.0",
-        note = "deprecated in favor of the accessor \
-                methods of this trait"
-    )]
-    #[allow(deprecated)]
-    fn as_raw_stat(&self) -> &raw::stat;
-
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_dev(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_ino(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_mode(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_nlink(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_uid(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_gid(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_rdev(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_size(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_atime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_atime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_mtime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_mtime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_ctime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_ctime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_birthtime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_birthtime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_blksize(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_blocks(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_flags(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_gen(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_lspare(&self) -> u32;
-}
-
-#[stable(feature = "metadata_ext", since = "1.1.0")]
-impl MetadataExt for Metadata {
-    #[allow(deprecated)]
-    fn as_raw_stat(&self) -> &raw::stat {
-        unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
-    }
-    fn st_dev(&self) -> u64 {
-        self.as_inner().as_inner().st_dev as u64
-    }
-    fn st_ino(&self) -> u64 {
-        self.as_inner().as_inner().st_ino as u64
-    }
-    fn st_mode(&self) -> u32 {
-        self.as_inner().as_inner().st_mode as u32
-    }
-    fn st_nlink(&self) -> u64 {
-        self.as_inner().as_inner().st_nlink as u64
-    }
-    fn st_uid(&self) -> u32 {
-        self.as_inner().as_inner().st_uid as u32
-    }
-    fn st_gid(&self) -> u32 {
-        self.as_inner().as_inner().st_gid as u32
-    }
-    fn st_rdev(&self) -> u64 {
-        self.as_inner().as_inner().st_rdev as u64
-    }
-    fn st_size(&self) -> u64 {
-        self.as_inner().as_inner().st_size as u64
-    }
-    fn st_atime(&self) -> i64 {
-        self.as_inner().as_inner().st_atime as i64
-    }
-    fn st_atime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_atime_nsec as i64
-    }
-    fn st_mtime(&self) -> i64 {
-        self.as_inner().as_inner().st_mtime as i64
-    }
-    fn st_mtime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_mtime_nsec as i64
-    }
-    fn st_ctime(&self) -> i64 {
-        self.as_inner().as_inner().st_ctime as i64
-    }
-    fn st_ctime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_ctime_nsec as i64
-    }
-    fn st_birthtime(&self) -> i64 {
-        self.as_inner().as_inner().st_birthtime as i64
-    }
-    fn st_birthtime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_birthtime_nsec as i64
-    }
-    fn st_blksize(&self) -> u64 {
-        self.as_inner().as_inner().st_blksize as u64
-    }
-    fn st_blocks(&self) -> u64 {
-        self.as_inner().as_inner().st_blocks as u64
-    }
-    fn st_gen(&self) -> u32 {
-        self.as_inner().as_inner().st_gen as u32
-    }
-    fn st_flags(&self) -> u32 {
-        self.as_inner().as_inner().st_flags as u32
-    }
-    fn st_lspare(&self) -> u32 {
-        self.as_inner().as_inner().st_lspare as u32
-    }
-}
-
-/// OS-specific extensions to [`fs::FileTimes`].
-#[stable(feature = "file_set_times", since = "1.75.0")]
-pub trait FileTimesExt: Sealed {
-    /// Set the creation time of a file.
-    #[stable(feature = "file_set_times", since = "1.75.0")]
-    fn set_created(self, t: SystemTime) -> Self;
-}
-
-#[stable(feature = "file_set_times", since = "1.75.0")]
-impl FileTimesExt for fs::FileTimes {
-    fn set_created(mut self, t: SystemTime) -> Self {
-        self.as_inner_mut().set_created(t.into_inner());
-        self
-    }
-}
diff --git a/library/std/src/os/visionos/mod.rs b/library/std/src/os/visionos/mod.rs
deleted file mode 100644
index f4b061ffda8..00000000000
--- a/library/std/src/os/visionos/mod.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//! visionos-specific definitions
-
-#![stable(feature = "raw_ext", since = "1.1.0")]
-
-pub mod fs;
-pub mod raw;
diff --git a/library/std/src/os/visionos/raw.rs b/library/std/src/os/visionos/raw.rs
deleted file mode 100644
index 2b3eca6f493..00000000000
--- a/library/std/src/os/visionos/raw.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-//! visionos-specific raw type definitions
-
-#![stable(feature = "raw_ext", since = "1.1.0")]
-#![deprecated(
-    since = "1.8.0",
-    note = "these type aliases are no longer supported by \
-            the standard library, the `libc` crate on \
-            crates.io should be used instead for the correct \
-            definitions"
-)]
-#![allow(deprecated)]
-
-use crate::os::raw::c_long;
-
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type blkcnt_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type blksize_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type dev_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type ino_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type mode_t = u32;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type nlink_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type off_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type time_t = i64;
-
-#[stable(feature = "pthread_t", since = "1.8.0")]
-pub type pthread_t = usize;
-
-#[repr(C)]
-#[derive(Clone)]
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub struct stat {
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_dev: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_mode: u16,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_nlink: u16,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_ino: u64,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_uid: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_gid: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_rdev: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_atime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_atime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_mtime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_mtime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_ctime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_ctime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_birthtime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_birthtime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_size: i64,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_blocks: i64,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_blksize: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_flags: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_gen: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_lspare: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_qspare: [i64; 2],
-}
diff --git a/library/std/src/os/watchos/fs.rs b/library/std/src/os/watchos/fs.rs
deleted file mode 100644
index ee215dd5984..00000000000
--- a/library/std/src/os/watchos/fs.rs
+++ /dev/null
@@ -1,160 +0,0 @@
-#![stable(feature = "metadata_ext", since = "1.1.0")]
-
-use crate::fs::{self, Metadata};
-use crate::sealed::Sealed;
-use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
-use crate::time::SystemTime;
-
-#[allow(deprecated)]
-use crate::os::watchos::raw;
-
-/// OS-specific extensions to [`fs::Metadata`].
-///
-/// [`fs::Metadata`]: crate::fs::Metadata
-#[stable(feature = "metadata_ext", since = "1.1.0")]
-pub trait MetadataExt {
-    /// Gain a reference to the underlying `stat` structure which contains
-    /// the raw information returned by the OS.
-    ///
-    /// The contents of the returned `stat` are **not** consistent across
-    /// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
-    /// cross-Unix abstractions contained within the raw stat.
-    #[stable(feature = "metadata_ext", since = "1.1.0")]
-    #[deprecated(
-        since = "1.8.0",
-        note = "deprecated in favor of the accessor \
-                  methods of this trait"
-    )]
-    #[allow(deprecated)]
-    fn as_raw_stat(&self) -> &raw::stat;
-
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_dev(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_ino(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_mode(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_nlink(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_uid(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_gid(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_rdev(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_size(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_atime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_atime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_mtime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_mtime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_ctime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_ctime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_birthtime(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_birthtime_nsec(&self) -> i64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_blksize(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_blocks(&self) -> u64;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_flags(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_gen(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_lspare(&self) -> u32;
-}
-
-#[stable(feature = "metadata_ext", since = "1.1.0")]
-impl MetadataExt for Metadata {
-    #[allow(deprecated)]
-    fn as_raw_stat(&self) -> &raw::stat {
-        unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
-    }
-    fn st_dev(&self) -> u64 {
-        self.as_inner().as_inner().st_dev as u64
-    }
-    fn st_ino(&self) -> u64 {
-        self.as_inner().as_inner().st_ino as u64
-    }
-    fn st_mode(&self) -> u32 {
-        self.as_inner().as_inner().st_mode as u32
-    }
-    fn st_nlink(&self) -> u64 {
-        self.as_inner().as_inner().st_nlink as u64
-    }
-    fn st_uid(&self) -> u32 {
-        self.as_inner().as_inner().st_uid as u32
-    }
-    fn st_gid(&self) -> u32 {
-        self.as_inner().as_inner().st_gid as u32
-    }
-    fn st_rdev(&self) -> u64 {
-        self.as_inner().as_inner().st_rdev as u64
-    }
-    fn st_size(&self) -> u64 {
-        self.as_inner().as_inner().st_size as u64
-    }
-    fn st_atime(&self) -> i64 {
-        self.as_inner().as_inner().st_atime as i64
-    }
-    fn st_atime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_atime_nsec as i64
-    }
-    fn st_mtime(&self) -> i64 {
-        self.as_inner().as_inner().st_mtime as i64
-    }
-    fn st_mtime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_mtime_nsec as i64
-    }
-    fn st_ctime(&self) -> i64 {
-        self.as_inner().as_inner().st_ctime as i64
-    }
-    fn st_ctime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_ctime_nsec as i64
-    }
-    fn st_birthtime(&self) -> i64 {
-        self.as_inner().as_inner().st_birthtime as i64
-    }
-    fn st_birthtime_nsec(&self) -> i64 {
-        self.as_inner().as_inner().st_birthtime_nsec as i64
-    }
-    fn st_blksize(&self) -> u64 {
-        self.as_inner().as_inner().st_blksize as u64
-    }
-    fn st_blocks(&self) -> u64 {
-        self.as_inner().as_inner().st_blocks as u64
-    }
-    fn st_gen(&self) -> u32 {
-        self.as_inner().as_inner().st_gen as u32
-    }
-    fn st_flags(&self) -> u32 {
-        self.as_inner().as_inner().st_flags as u32
-    }
-    fn st_lspare(&self) -> u32 {
-        self.as_inner().as_inner().st_lspare as u32
-    }
-}
-
-/// OS-specific extensions to [`fs::FileTimes`].
-#[stable(feature = "file_set_times", since = "1.75.0")]
-pub trait FileTimesExt: Sealed {
-    /// Set the creation time of a file.
-    #[stable(feature = "file_set_times", since = "1.75.0")]
-    fn set_created(self, t: SystemTime) -> Self;
-}
-
-#[stable(feature = "file_set_times", since = "1.75.0")]
-impl FileTimesExt for fs::FileTimes {
-    fn set_created(mut self, t: SystemTime) -> Self {
-        self.as_inner_mut().set_created(t.into_inner());
-        self
-    }
-}
diff --git a/library/std/src/os/watchos/mod.rs b/library/std/src/os/watchos/mod.rs
deleted file mode 100644
index cd6454ebbf9..00000000000
--- a/library/std/src/os/watchos/mod.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//! watchOS-specific definitions
-
-#![stable(feature = "raw_ext", since = "1.1.0")]
-
-pub mod fs;
-pub mod raw;
diff --git a/library/std/src/os/watchos/raw.rs b/library/std/src/os/watchos/raw.rs
deleted file mode 100644
index 630a533d9aa..00000000000
--- a/library/std/src/os/watchos/raw.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-//! watchOS-specific raw type definitions
-
-#![stable(feature = "raw_ext", since = "1.1.0")]
-#![deprecated(
-    since = "1.8.0",
-    note = "these type aliases are no longer supported by \
-              the standard library, the `libc` crate on \
-              crates.io should be used instead for the correct \
-              definitions"
-)]
-#![allow(deprecated)]
-
-use crate::os::raw::c_long;
-
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type blkcnt_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type blksize_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type dev_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type ino_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type mode_t = u32;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type nlink_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type off_t = u64;
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub type time_t = i64;
-
-#[stable(feature = "pthread_t", since = "1.8.0")]
-pub type pthread_t = usize;
-
-#[repr(C)]
-#[derive(Clone)]
-#[stable(feature = "raw_ext", since = "1.1.0")]
-pub struct stat {
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_dev: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_mode: u16,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_nlink: u16,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_ino: u64,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_uid: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_gid: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_rdev: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_atime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_atime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_mtime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_mtime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_ctime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_ctime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_birthtime: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_birthtime_nsec: c_long,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_size: i64,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_blocks: i64,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_blksize: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_flags: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_gen: u32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_lspare: i32,
-    #[stable(feature = "raw_ext", since = "1.1.0")]
-    pub st_qspare: [i64; 2],
-}