Skip to content

Commit 0425411

Browse files
authored
Unrolled build for rust-lang#121419
Rollup merge of rust-lang#121419 - agg23:xrOS-pr, r=davidtwco Add aarch64-apple-visionos and aarch64-apple-visionos-sim tier 3 targets Introduces `aarch64-apple-visionos` and `aarch64-apple-visionos-sim` as tier 3 targets. This allows native development for the Apple Vision Pro's visionOS platform. This work has been tracked in rust-lang/compiler-team#642. There is a corresponding `libc` change rust-lang/libc#3568 that is not required for merge. Ideally we would be able to incorporate [this change](gimli-rs/object#626) to the `object` crate, but the author has stated that a release will not be cut for quite a while. Therefore, the two locations that would reference the xrOS constant from `object` are hardcoded to their MachO values of 11 and 12, accompanied by TODOs to mark the code as needing change. I am open to suggestions on what to do here to get this checked in. # Tier 3 Target Policy At this tier, the Rust project provides no official support for a target, so we place minimal requirements on the introduction of targets. > A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.) See [src/doc/rustc/src/platform-support/apple-visionos.md](https://github.com./rust-lang/rust/blob/e88379034a0fe7d90a8f305bbaf4ad66dd2ce8dc/src/doc/rustc/src/platform-support/apple-visionos.md) > Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target. > * Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it. > * If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known to cause issues in Cargo. This naming scheme matches `$ARCH-$VENDOR-$OS-$ABI` which is matches the iOS Apple Silicon simulator (`aarch64-apple-ios-sim`) and other Apple targets. > Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users. > - The target must not introduce license incompatibilities. > - Anything added to the Rust repository must be under the standard Rust license (`MIT OR Apache-2.0`). > - The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the `tidy` tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to besubject to any new license requirements. > - Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, `rustc` built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3. > - "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are *not* limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users. This contribution is fully available under the standard Rust license with no additional legal restrictions whatsoever. This PR does not introduce any new dependency less permissive than the Rust license policy. The new targets do not depend on proprietary libraries. > Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions. This new target mirrors the standard library for watchOS and iOS, with minor divergences. > The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary. Documentation is provided in [src/doc/rustc/src/platform-support/apple-visionos.md](https://github.com./rust-lang/rust/blob/e88379034a0fe7d90a8f305bbaf4ad66dd2ce8dc/src/doc/rustc/src/platform-support/apple-visionos.md) > Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions. > * This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements. > Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages. > * Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications. > Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target. > * In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target. I acknowledge these requirements and intend to ensure that they are met. This target does not touch any existing tier 2 or tier 1 targets and should not break any other targets.
2 parents 9d79cd5 + 288a615 commit 0425411

File tree

46 files changed

+569
-30
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+569
-30
lines changed

compiler/rustc_codegen_llvm/src/back/write.rs

+1
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,7 @@ fn target_is_apple(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
912912
|| cgcx.opts.target_triple.triple().contains("-darwin")
913913
|| cgcx.opts.target_triple.triple().contains("-tvos")
914914
|| cgcx.opts.target_triple.triple().contains("-watchos")
915+
|| cgcx.opts.target_triple.triple().contains("-visionos")
915916
}
916917

917918
fn target_is_aix(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {

compiler/rustc_codegen_ssa/src/back/link.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -2946,7 +2946,7 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
29462946
let os = &sess.target.os;
29472947
let llvm_target = &sess.target.llvm_target;
29482948
if sess.target.vendor != "apple"
2949-
|| !matches!(os.as_ref(), "ios" | "tvos" | "watchos" | "macos")
2949+
|| !matches!(os.as_ref(), "ios" | "tvos" | "watchos" | "visionos" | "macos")
29502950
|| !matches!(flavor, LinkerFlavor::Darwin(..))
29512951
{
29522952
return;
@@ -2971,6 +2971,8 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
29712971
("arm64_32", "watchos") => "watchos",
29722972
("aarch64", "watchos") if llvm_target.ends_with("-simulator") => "watchsimulator",
29732973
("aarch64", "watchos") => "watchos",
2974+
("aarch64", "visionos") if llvm_target.ends_with("-simulator") => "xrsimulator",
2975+
("aarch64", "visionos") => "xros",
29742976
("arm", "watchos") => "watchos",
29752977
(_, "macos") => "macosx",
29762978
_ => {
@@ -3027,6 +3029,10 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result<String, errors::AppleSdkRootErro
30273029
|| sdkroot.contains("MacOSX.platform") => {}
30283030
"watchsimulator"
30293031
if sdkroot.contains("WatchOS.platform") || sdkroot.contains("MacOSX.platform") => {}
3032+
"visionos"
3033+
if sdkroot.contains("XROS.platform") || sdkroot.contains("MacOSX.platform") => {}
3034+
"visionossimulator"
3035+
if sdkroot.contains("XROS.platform") || sdkroot.contains("MacOSX.platform") => {}
30303036
// Ignore `SDKROOT` if it's not a valid path.
30313037
_ if !p.is_absolute() || p == Path::new("/") || !p.exists() => {}
30323038
_ => return Ok(sdkroot),

compiler/rustc_target/src/spec/base/apple/mod.rs

+24
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
102102
"ios" => ios_deployment_target(arch, abi),
103103
"tvos" => tvos_deployment_target(),
104104
"watchos" => watchos_deployment_target(),
105+
"visionos" => visionos_deployment_target(),
105106
"macos" => macos_deployment_target(arch),
106107
_ => unreachable!(),
107108
};
@@ -202,6 +203,8 @@ pub fn sdk_version(platform: u32) -> Option<(u32, u32)> {
202203
| object::macho::PLATFORM_TVOSSIMULATOR
203204
| object::macho::PLATFORM_MACCATALYST => Some((16, 2)),
204205
object::macho::PLATFORM_WATCHOS | object::macho::PLATFORM_WATCHOSSIMULATOR => Some((9, 1)),
206+
// FIXME: Upgrade to `object-rs` 0.33+ implementation with visionOS platform definition
207+
11 | 12 => Some((1, 0)),
205208
_ => None,
206209
}
207210
}
@@ -216,6 +219,9 @@ pub fn platform(target: &Target) -> Option<u32> {
216219
("watchos", _) => object::macho::PLATFORM_WATCHOS,
217220
("tvos", "sim") => object::macho::PLATFORM_TVOSSIMULATOR,
218221
("tvos", _) => object::macho::PLATFORM_TVOS,
222+
// FIXME: Upgrade to `object-rs` 0.33+ implementation with visionOS platform definition
223+
("visionos", "sim") => 12,
224+
("visionos", _) => 11,
219225
_ => return None,
220226
})
221227
}
@@ -240,6 +246,7 @@ pub fn deployment_target(target: &Target) -> Option<(u32, u32)> {
240246
}
241247
"watchos" => watchos_deployment_target(),
242248
"tvos" => tvos_deployment_target(),
249+
"visionos" => visionos_deployment_target(),
243250
_ => return None,
244251
};
245252

@@ -290,6 +297,7 @@ fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
290297
|| sdkroot.contains("AppleTVSimulator.platform")
291298
|| sdkroot.contains("WatchOS.platform")
292299
|| sdkroot.contains("WatchSimulator.platform")
300+
|| sdkroot.contains("XROS.platform")
293301
{
294302
env_remove.push("SDKROOT".into())
295303
}
@@ -299,6 +307,7 @@ fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
299307
// although this is apparently ignored when using the linker at "/usr/bin/ld".
300308
env_remove.push("IPHONEOS_DEPLOYMENT_TARGET".into());
301309
env_remove.push("TVOS_DEPLOYMENT_TARGET".into());
310+
env_remove.push("XROS_DEPLOYMENT_TARGET".into());
302311
env_remove.into()
303312
} else {
304313
// Otherwise if cross-compiling for a different OS/SDK (including Mac Catalyst), remove any part
@@ -363,3 +372,18 @@ pub fn watchos_sim_llvm_target(arch: Arch) -> String {
363372
let (major, minor) = watchos_deployment_target();
364373
format!("{}-apple-watchos{}.{}.0-simulator", arch.target_name(), major, minor)
365374
}
375+
376+
fn visionos_deployment_target() -> (u32, u32) {
377+
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
378+
from_set_deployment_target("XROS_DEPLOYMENT_TARGET").unwrap_or((1, 0))
379+
}
380+
381+
pub fn visionos_llvm_target(arch: Arch) -> String {
382+
let (major, minor) = visionos_deployment_target();
383+
format!("{}-apple-visionos{}.{}.0", arch.target_name(), major, minor)
384+
}
385+
386+
pub fn visionos_sim_llvm_target(arch: Arch) -> String {
387+
let (major, minor) = visionos_deployment_target();
388+
format!("{}-apple-visionos{}.{}.0-simulator", arch.target_name(), major, minor)
389+
}

compiler/rustc_target/src/spec/base/apple/tests.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::spec::targets::{
2-
aarch64_apple_darwin, aarch64_apple_ios_sim, aarch64_apple_watchos_sim, i686_apple_darwin,
3-
x86_64_apple_darwin, x86_64_apple_ios, x86_64_apple_tvos, x86_64_apple_watchos_sim,
2+
aarch64_apple_darwin, aarch64_apple_ios_sim, aarch64_apple_visionos_sim,
3+
aarch64_apple_watchos_sim, i686_apple_darwin, x86_64_apple_darwin, x86_64_apple_ios,
4+
x86_64_apple_tvos, x86_64_apple_watchos_sim,
45
};
56

67
#[test]
@@ -12,6 +13,7 @@ fn simulator_targets_set_abi() {
1213
aarch64_apple_ios_sim::target(),
1314
// Note: There is currently no ARM64 tvOS simulator target
1415
aarch64_apple_watchos_sim::target(),
16+
aarch64_apple_visionos_sim::target(),
1517
];
1618

1719
for target in &all_sim_targets {
@@ -32,7 +34,11 @@ fn macos_link_environment_unmodified() {
3234
// for the host.
3335
assert_eq!(
3436
target.link_env_remove,
35-
crate::spec::cvs!["IPHONEOS_DEPLOYMENT_TARGET", "TVOS_DEPLOYMENT_TARGET"],
37+
crate::spec::cvs![
38+
"IPHONEOS_DEPLOYMENT_TARGET",
39+
"TVOS_DEPLOYMENT_TARGET",
40+
"XROS_DEPLOYMENT_TARGET"
41+
],
3642
);
3743
}
3844
}

compiler/rustc_target/src/spec/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,9 @@ supported_targets! {
15571557
("aarch64-apple-watchos", aarch64_apple_watchos),
15581558
("aarch64-apple-watchos-sim", aarch64_apple_watchos_sim),
15591559

1560+
("aarch64-apple-visionos", aarch64_apple_visionos),
1561+
("aarch64-apple-visionos-sim", aarch64_apple_visionos_sim),
1562+
15601563
("armebv7r-none-eabi", armebv7r_none_eabi),
15611564
("armebv7r-none-eabihf", armebv7r_none_eabihf),
15621565
("armv7r-none-eabi", armv7r_none_eabi),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use crate::spec::base::apple::{opts, visionos_llvm_target, Arch};
2+
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
3+
4+
pub fn target() -> Target {
5+
let arch = Arch::Arm64;
6+
let mut base = opts("visionos", arch);
7+
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
8+
9+
Target {
10+
llvm_target: visionos_llvm_target(arch).into(),
11+
metadata: crate::spec::TargetMetadata {
12+
description: Some("ARM64 Apple visionOS".into()),
13+
tier: Some(3),
14+
host_tools: Some(false),
15+
std: Some(false),
16+
},
17+
pointer_width: 64,
18+
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
19+
arch: arch.target_arch(),
20+
options: TargetOptions {
21+
features: "+neon,+fp-armv8,+apple-a16".into(),
22+
max_atomic_width: Some(128),
23+
frame_pointer: FramePointer::NonLeaf,
24+
..base
25+
},
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use crate::spec::base::apple::{opts, visionos_sim_llvm_target, Arch};
2+
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
3+
4+
pub fn target() -> Target {
5+
let arch = Arch::Arm64_sim;
6+
let mut base = opts("visionos", arch);
7+
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
8+
9+
Target {
10+
llvm_target: visionos_sim_llvm_target(arch).into(),
11+
metadata: crate::spec::TargetMetadata {
12+
description: Some("ARM64 Apple visionOS simulator".into()),
13+
tier: Some(3),
14+
host_tools: Some(false),
15+
std: Some(false),
16+
},
17+
pointer_width: 64,
18+
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
19+
arch: arch.target_arch(),
20+
options: TargetOptions {
21+
features: "+neon,+fp-armv8,+apple-a16".into(),
22+
max_atomic_width: Some(128),
23+
frame_pointer: FramePointer::NonLeaf,
24+
..base
25+
},
26+
}
27+
}

library/std/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ fn main() {
2222
|| target_os == "ios"
2323
|| target_os == "tvos"
2424
|| target_os == "watchos"
25+
|| target_os == "visionos"
2526
|| target_os == "windows"
2627
|| target_os == "fuchsia"
2728
|| (target_vendor == "fortanix" && target_env == "sgx")

library/std/src/fs/tests.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -1644,8 +1644,8 @@ fn test_file_times() {
16441644
use crate::os::macos::fs::FileTimesExt;
16451645
#[cfg(target_os = "tvos")]
16461646
use crate::os::tvos::fs::FileTimesExt;
1647-
#[cfg(target_os = "tvos")]
1648-
use crate::os::tvos::fs::FileTimesExt;
1647+
#[cfg(target_os = "visionos")]
1648+
use crate::os::visionos::fs::FileTimesExt;
16491649
#[cfg(target_os = "watchos")]
16501650
use crate::os::watchos::fs::FileTimesExt;
16511651
#[cfg(windows)]
@@ -1662,6 +1662,7 @@ fn test_file_times() {
16621662
target_os = "macos",
16631663
target_os = "ios",
16641664
target_os = "watchos",
1665+
target_os = "visionos",
16651666
target_os = "tvos",
16661667
))]
16671668
let created = SystemTime::UNIX_EPOCH + Duration::from_secs(32123);
@@ -1670,6 +1671,7 @@ fn test_file_times() {
16701671
target_os = "macos",
16711672
target_os = "ios",
16721673
target_os = "watchos",
1674+
target_os = "visionos",
16731675
target_os = "tvos",
16741676
))]
16751677
{
@@ -1701,6 +1703,7 @@ fn test_file_times() {
17011703
target_os = "macos",
17021704
target_os = "ios",
17031705
target_os = "watchos",
1706+
target_os = "visionos",
17041707
target_os = "tvos",
17051708
))]
17061709
{
@@ -1709,14 +1712,22 @@ fn test_file_times() {
17091712
}
17101713

17111714
#[test]
1712-
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
1715+
#[cfg(any(
1716+
target_os = "macos",
1717+
target_os = "ios",
1718+
target_os = "tvos",
1719+
target_os = "watchos",
1720+
target_os = "visionos"
1721+
))]
17131722
fn test_file_times_pre_epoch_with_nanos() {
17141723
#[cfg(target_os = "ios")]
17151724
use crate::os::ios::fs::FileTimesExt;
17161725
#[cfg(target_os = "macos")]
17171726
use crate::os::macos::fs::FileTimesExt;
17181727
#[cfg(target_os = "tvos")]
17191728
use crate::os::tvos::fs::FileTimesExt;
1729+
#[cfg(target_os = "visionos")]
1730+
use crate::os::visionos::fs::FileTimesExt;
17201731
#[cfg(target_os = "watchos")]
17211732
use crate::os::watchos::fs::FileTimesExt;
17221733

library/std/src/os/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ pub mod solid;
149149
pub(crate) mod tvos;
150150
#[cfg(target_os = "uefi")]
151151
pub mod uefi;
152+
#[cfg(target_os = "visionos")]
153+
pub(crate) mod visionos;
152154
#[cfg(target_os = "vita")]
153155
pub mod vita;
154156
#[cfg(target_os = "vxworks")]

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

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ mod platform {
7979
pub use crate::os::solaris::*;
8080
#[cfg(target_os = "tvos")]
8181
pub use crate::os::tvos::*;
82+
#[cfg(target_os = "visionos")]
83+
pub use crate::os::visionos::*;
8284
#[cfg(target_os = "vita")]
8385
pub use crate::os::vita::*;
8486
#[cfg(target_os = "vxworks")]

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

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ mod tests;
2020
target_os = "ios",
2121
target_os = "tvos",
2222
target_os = "watchos",
23+
target_os = "visionos",
2324
target_os = "macos",
2425
target_os = "netbsd",
2526
target_os = "openbsd",
@@ -46,6 +47,7 @@ pub use self::stream::*;
4647
target_os = "ios",
4748
target_os = "tvos",
4849
target_os = "watchos",
50+
target_os = "visionos",
4951
target_os = "macos",
5052
target_os = "netbsd",
5153
target_os = "openbsd",

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

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
target_os = "tvos",
88
target_os = "macos",
99
target_os = "watchos",
10+
target_os = "visionos",
1011
target_os = "netbsd",
1112
target_os = "openbsd",
1213
target_os = "nto"
@@ -234,6 +235,7 @@ impl UnixStream {
234235
target_os = "tvos",
235236
target_os = "macos",
236237
target_os = "watchos",
238+
target_os = "visionos",
237239
target_os = "netbsd",
238240
target_os = "openbsd",
239241
target_os = "nto"

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

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

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

4147
#[cfg(any(target_os = "linux", target_os = "android"))]
@@ -97,7 +103,13 @@ mod impl_bsd {
97103
}
98104
}
99105

100-
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
106+
#[cfg(any(
107+
target_os = "macos",
108+
target_os = "ios",
109+
target_os = "tvos",
110+
target_os = "watchos",
111+
target_os = "visionos"
112+
))]
101113
mod impl_mac {
102114
use super::UCred;
103115
use crate::os::unix::io::AsRawFd;

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

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use libc::{getegid, geteuid, getpid};
1111
target_os = "tvos",
1212
target_os = "macos",
1313
target_os = "watchos",
14+
target_os = "visionos",
1415
target_os = "openbsd"
1516
))]
1617
fn test_socket_pair() {
@@ -32,6 +33,7 @@ fn test_socket_pair() {
3233
target_os = "ios",
3334
target_os = "macos",
3435
target_os = "watchos",
36+
target_os = "visionos",
3537
target_os = "tvos",
3638
))]
3739
fn test_socket_pair_pids(arg: Type) -> RetType {

0 commit comments

Comments
 (0)