Skip to content

Commit d2f0f29

Browse files
committed
Use target_vendor = "apple" instead of target_os = "..."
1 parent 585e788 commit d2f0f29

File tree

18 files changed

+74
-336
lines changed

18 files changed

+74
-336
lines changed

std/src/fs/tests.rs

+4-31
Original file line numberDiff line numberDiff line change
@@ -1657,23 +1657,9 @@ fn test_file_times() {
16571657
let accessed = SystemTime::UNIX_EPOCH + Duration::from_secs(12345);
16581658
let modified = SystemTime::UNIX_EPOCH + Duration::from_secs(54321);
16591659
times = times.set_accessed(accessed).set_modified(modified);
1660-
#[cfg(any(
1661-
windows,
1662-
target_os = "macos",
1663-
target_os = "ios",
1664-
target_os = "watchos",
1665-
target_os = "visionos",
1666-
target_os = "tvos",
1667-
))]
1660+
#[cfg(any(windows, target_vendor = "apple"))]
16681661
let created = SystemTime::UNIX_EPOCH + Duration::from_secs(32123);
1669-
#[cfg(any(
1670-
windows,
1671-
target_os = "macos",
1672-
target_os = "ios",
1673-
target_os = "watchos",
1674-
target_os = "visionos",
1675-
target_os = "tvos",
1676-
))]
1662+
#[cfg(any(windows, target_vendor = "apple"))]
16771663
{
16781664
times = times.set_created(created);
16791665
}
@@ -1698,27 +1684,14 @@ fn test_file_times() {
16981684
let metadata = file.metadata().unwrap();
16991685
assert_eq!(metadata.accessed().unwrap(), accessed);
17001686
assert_eq!(metadata.modified().unwrap(), modified);
1701-
#[cfg(any(
1702-
windows,
1703-
target_os = "macos",
1704-
target_os = "ios",
1705-
target_os = "watchos",
1706-
target_os = "visionos",
1707-
target_os = "tvos",
1708-
))]
1687+
#[cfg(any(windows, target_vendor = "apple"))]
17091688
{
17101689
assert_eq!(metadata.created().unwrap(), created);
17111690
}
17121691
}
17131692

17141693
#[test]
1715-
#[cfg(any(
1716-
target_os = "macos",
1717-
target_os = "ios",
1718-
target_os = "tvos",
1719-
target_os = "watchos",
1720-
target_os = "visionos"
1721-
))]
1694+
#[cfg(target_vendor = "apple")]
17221695
fn test_file_times_pre_epoch_with_nanos() {
17231696
#[cfg(target_os = "ios")]
17241697
use crate::os::ios::fs::FileTimesExt;

std/src/os/unix/net/mod.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@ mod tests;
1717
target_os = "linux",
1818
target_os = "dragonfly",
1919
target_os = "freebsd",
20-
target_os = "ios",
21-
target_os = "tvos",
22-
target_os = "watchos",
23-
target_os = "visionos",
24-
target_os = "macos",
2520
target_os = "netbsd",
2621
target_os = "openbsd",
2722
target_os = "nto",
23+
target_vendor = "apple",
2824
))]
2925
mod ucred;
3026

@@ -44,14 +40,10 @@ pub use self::stream::*;
4440
target_os = "linux",
4541
target_os = "dragonfly",
4642
target_os = "freebsd",
47-
target_os = "ios",
48-
target_os = "tvos",
49-
target_os = "watchos",
50-
target_os = "visionos",
51-
target_os = "macos",
5243
target_os = "netbsd",
5344
target_os = "openbsd",
5445
target_os = "nto",
46+
target_vendor = "apple",
5547
))]
5648
#[unstable(feature = "peer_credentials_unix_socket", issue = "42839", reason = "unstable")]
5749
pub use self::ucred::*;

std/src/os/unix/net/stream.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
target_os = "linux",
44
target_os = "dragonfly",
55
target_os = "freebsd",
6-
target_os = "ios",
7-
target_os = "tvos",
8-
target_os = "macos",
9-
target_os = "watchos",
10-
target_os = "visionos",
116
target_os = "netbsd",
127
target_os = "openbsd",
13-
target_os = "nto"
8+
target_os = "nto",
9+
target_vendor = "apple",
1410
))]
1511
use super::{peer_cred, UCred};
1612
#[cfg(any(doc, target_os = "android", target_os = "linux"))]
@@ -231,14 +227,10 @@ impl UnixStream {
231227
target_os = "linux",
232228
target_os = "dragonfly",
233229
target_os = "freebsd",
234-
target_os = "ios",
235-
target_os = "tvos",
236-
target_os = "macos",
237-
target_os = "watchos",
238-
target_os = "visionos",
239230
target_os = "netbsd",
240231
target_os = "openbsd",
241-
target_os = "nto"
232+
target_os = "nto",
233+
target_vendor = "apple",
242234
))]
243235
pub fn peer_cred(&self) -> io::Result<UCred> {
244236
peer_cred(self)

std/src/os/unix/net/ucred.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,8 @@ pub(super) use self::impl_linux::peer_cred;
3535
))]
3636
pub(super) use self::impl_bsd::peer_cred;
3737

38-
#[cfg(any(
39-
target_os = "macos",
40-
target_os = "ios",
41-
target_os = "tvos",
42-
target_os = "watchos",
43-
target_os = "visionos"
44-
))]
45-
pub(super) use self::impl_mac::peer_cred;
38+
#[cfg(target_vendor = "apple")]
39+
pub(super) use self::impl_apple::peer_cred;
4640

4741
#[cfg(any(target_os = "linux", target_os = "android"))]
4842
mod impl_linux {
@@ -103,14 +97,8 @@ mod impl_bsd {
10397
}
10498
}
10599

106-
#[cfg(any(
107-
target_os = "macos",
108-
target_os = "ios",
109-
target_os = "tvos",
110-
target_os = "watchos",
111-
target_os = "visionos"
112-
))]
113-
mod impl_mac {
100+
#[cfg(target_vendor = "apple")]
101+
mod impl_apple {
114102
use super::UCred;
115103
use crate::os::unix::io::AsRawFd;
116104
use crate::os::unix::net::UnixStream;

std/src/os/unix/net/ucred/tests.rs

+3-14
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ use libc::{getegid, geteuid, getpid};
77
target_os = "linux",
88
target_os = "dragonfly",
99
target_os = "freebsd",
10-
target_os = "ios",
11-
target_os = "tvos",
12-
target_os = "macos",
13-
target_os = "watchos",
14-
target_os = "visionos",
15-
target_os = "openbsd"
10+
target_os = "openbsd",
11+
target_vendor = "apple",
1612
))]
1713
fn test_socket_pair() {
1814
// Create two connected sockets and get their peer credentials. They should be equal.
@@ -28,14 +24,7 @@ fn test_socket_pair() {
2824
}
2925

3026
#[test]
31-
#[cfg(any(
32-
target_os = "linux",
33-
target_os = "ios",
34-
target_os = "macos",
35-
target_os = "watchos",
36-
target_os = "visionos",
37-
target_os = "tvos",
38-
))]
27+
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
3928
fn test_socket_pair_pids(arg: Type) -> RetType {
4029
// Create two connected sockets and get their peer credentials.
4130
let (sock_a, sock_b) = UnixStream::pair().unwrap();

std/src/sys/pal/unix/args.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,7 @@ mod imp {
168168
}
169169
}
170170

171-
#[cfg(any(
172-
target_os = "macos",
173-
target_os = "ios",
174-
target_os = "watchos",
175-
target_os = "visionos",
176-
target_os = "tvos"
177-
))]
171+
#[cfg(target_vendor = "apple")]
178172
mod imp {
179173
use super::Args;
180174
use crate::ffi::CStr;
@@ -215,12 +209,7 @@ mod imp {
215209
// for i in (0..[args count])
216210
// res.push([args objectAtIndex:i])
217211
// res
218-
#[cfg(any(
219-
target_os = "ios",
220-
target_os = "tvos",
221-
target_os = "watchos",
222-
target_os = "visionos"
223-
))]
212+
#[cfg(not(target_os = "macos"))]
224213
pub fn args() -> Args {
225214
use crate::ffi::{c_char, c_void, OsString};
226215
use crate::mem;

0 commit comments

Comments
 (0)