about summary refs log tree commit diff
path: root/library/std/src/os/unix/net
diff options
context:
space:
mode:
authorMads Marquart <mads@marquart.dk>2024-04-28 18:22:37 +0200
committerMads Marquart <mads@marquart.dk>2024-04-28 18:22:37 +0200
commitd9c0eb8084deb65de69b23a7714b66efbff7eb03 (patch)
treeaac29bbed1315261cad4d77a0025225c1ee658f4 /library/std/src/os/unix/net
parentcb4940645775f60d74aee2e018d6c516c5aa9ed7 (diff)
downloadrust-d9c0eb8084deb65de69b23a7714b66efbff7eb03.tar.gz
rust-d9c0eb8084deb65de69b23a7714b66efbff7eb03.zip
Use `target_vendor = "apple"` instead of `target_os = "..."`
Diffstat (limited to 'library/std/src/os/unix/net')
-rw-r--r--library/std/src/os/unix/net/mod.rs12
-rw-r--r--library/std/src/os/unix/net/stream.rs16
-rw-r--r--library/std/src/os/unix/net/ucred.rs20
-rw-r--r--library/std/src/os/unix/net/ucred/tests.rs17
4 files changed, 13 insertions, 52 deletions
diff --git a/library/std/src/os/unix/net/mod.rs b/library/std/src/os/unix/net/mod.rs
index 16d9cd915ac..3e45e3533ed 100644
--- a/library/std/src/os/unix/net/mod.rs
+++ b/library/std/src/os/unix/net/mod.rs
@@ -17,14 +17,10 @@ mod tests;
     target_os = "linux",
     target_os = "dragonfly",
     target_os = "freebsd",
-    target_os = "ios",
-    target_os = "tvos",
-    target_os = "watchos",
-    target_os = "visionos",
-    target_os = "macos",
     target_os = "netbsd",
     target_os = "openbsd",
     target_os = "nto",
+    target_vendor = "apple",
 ))]
 mod ucred;
 
@@ -44,14 +40,10 @@ pub use self::stream::*;
     target_os = "linux",
     target_os = "dragonfly",
     target_os = "freebsd",
-    target_os = "ios",
-    target_os = "tvos",
-    target_os = "watchos",
-    target_os = "visionos",
-    target_os = "macos",
     target_os = "netbsd",
     target_os = "openbsd",
     target_os = "nto",
+    target_vendor = "apple",
 ))]
 #[unstable(feature = "peer_credentials_unix_socket", issue = "42839", reason = "unstable")]
 pub use self::ucred::*;
diff --git a/library/std/src/os/unix/net/stream.rs b/library/std/src/os/unix/net/stream.rs
index 82b24dca1c4..19fc7b3d853 100644
--- a/library/std/src/os/unix/net/stream.rs
+++ b/library/std/src/os/unix/net/stream.rs
@@ -3,14 +3,10 @@
     target_os = "linux",
     target_os = "dragonfly",
     target_os = "freebsd",
-    target_os = "ios",
-    target_os = "tvos",
-    target_os = "macos",
-    target_os = "watchos",
-    target_os = "visionos",
     target_os = "netbsd",
     target_os = "openbsd",
-    target_os = "nto"
+    target_os = "nto",
+    target_vendor = "apple",
 ))]
 use super::{peer_cred, UCred};
 #[cfg(any(doc, target_os = "android", target_os = "linux"))]
@@ -231,14 +227,10 @@ impl UnixStream {
         target_os = "linux",
         target_os = "dragonfly",
         target_os = "freebsd",
-        target_os = "ios",
-        target_os = "tvos",
-        target_os = "macos",
-        target_os = "watchos",
-        target_os = "visionos",
         target_os = "netbsd",
         target_os = "openbsd",
-        target_os = "nto"
+        target_os = "nto",
+        target_vendor = "apple",
     ))]
     pub fn peer_cred(&self) -> io::Result<UCred> {
         peer_cred(self)
diff --git a/library/std/src/os/unix/net/ucred.rs b/library/std/src/os/unix/net/ucred.rs
index 3a752a53a50..1497e730bbf 100644
--- a/library/std/src/os/unix/net/ucred.rs
+++ b/library/std/src/os/unix/net/ucred.rs
@@ -35,14 +35,8 @@ pub(super) use self::impl_linux::peer_cred;
 ))]
 pub(super) use self::impl_bsd::peer_cred;
 
-#[cfg(any(
-    target_os = "macos",
-    target_os = "ios",
-    target_os = "tvos",
-    target_os = "watchos",
-    target_os = "visionos"
-))]
-pub(super) use self::impl_mac::peer_cred;
+#[cfg(target_vendor = "apple")]
+pub(super) use self::impl_apple::peer_cred;
 
 #[cfg(any(target_os = "linux", target_os = "android"))]
 mod impl_linux {
@@ -103,14 +97,8 @@ mod impl_bsd {
     }
 }
 
-#[cfg(any(
-    target_os = "macos",
-    target_os = "ios",
-    target_os = "tvos",
-    target_os = "watchos",
-    target_os = "visionos"
-))]
-mod impl_mac {
+#[cfg(target_vendor = "apple")]
+mod impl_apple {
     use super::UCred;
     use crate::os::unix::io::AsRawFd;
     use crate::os::unix::net::UnixStream;
diff --git a/library/std/src/os/unix/net/ucred/tests.rs b/library/std/src/os/unix/net/ucred/tests.rs
index 2a0797877c6..a6cc81318fc 100644
--- a/library/std/src/os/unix/net/ucred/tests.rs
+++ b/library/std/src/os/unix/net/ucred/tests.rs
@@ -7,12 +7,8 @@ use libc::{getegid, geteuid, getpid};
     target_os = "linux",
     target_os = "dragonfly",
     target_os = "freebsd",
-    target_os = "ios",
-    target_os = "tvos",
-    target_os = "macos",
-    target_os = "watchos",
-    target_os = "visionos",
-    target_os = "openbsd"
+    target_os = "openbsd",
+    target_vendor = "apple",
 ))]
 fn test_socket_pair() {
     // Create two connected sockets and get their peer credentials. They should be equal.
@@ -28,14 +24,7 @@ fn test_socket_pair() {
 }
 
 #[test]
-#[cfg(any(
-    target_os = "linux",
-    target_os = "ios",
-    target_os = "macos",
-    target_os = "watchos",
-    target_os = "visionos",
-    target_os = "tvos",
-))]
+#[cfg(any(target_os = "linux", target_vendor = "apple"))]
 fn test_socket_pair_pids(arg: Type) -> RetType {
     // Create two connected sockets and get their peer credentials.
     let (sock_a, sock_b) = UnixStream::pair().unwrap();