Rollup merge of #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 https://github.com/rust-lang/compiler-team/issues/642. There is a corresponding `libc` change https://github.com/rust-lang/libc/pull/3568 that is not required for merge. Ideally we would be able to incorporate [this change](https://github.com/gimli-rs/object/pull/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](e88379034a/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](e88379034a/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.
This commit is contained in:
commit
74a5bc6c9e
@ -912,6 +912,7 @@ fn target_is_apple(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
|
|||||||
|| cgcx.opts.target_triple.triple().contains("-darwin")
|
|| cgcx.opts.target_triple.triple().contains("-darwin")
|
||||||
|| cgcx.opts.target_triple.triple().contains("-tvos")
|
|| cgcx.opts.target_triple.triple().contains("-tvos")
|
||||||
|| cgcx.opts.target_triple.triple().contains("-watchos")
|
|| cgcx.opts.target_triple.triple().contains("-watchos")
|
||||||
|
|| cgcx.opts.target_triple.triple().contains("-visionos")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn target_is_aix(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
|
fn target_is_aix(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
|
||||||
|
@ -2946,7 +2946,7 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
|
|||||||
let os = &sess.target.os;
|
let os = &sess.target.os;
|
||||||
let llvm_target = &sess.target.llvm_target;
|
let llvm_target = &sess.target.llvm_target;
|
||||||
if sess.target.vendor != "apple"
|
if sess.target.vendor != "apple"
|
||||||
|| !matches!(os.as_ref(), "ios" | "tvos" | "watchos" | "macos")
|
|| !matches!(os.as_ref(), "ios" | "tvos" | "watchos" | "visionos" | "macos")
|
||||||
|| !matches!(flavor, LinkerFlavor::Darwin(..))
|
|| !matches!(flavor, LinkerFlavor::Darwin(..))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -2971,6 +2971,8 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
|
|||||||
("arm64_32", "watchos") => "watchos",
|
("arm64_32", "watchos") => "watchos",
|
||||||
("aarch64", "watchos") if llvm_target.ends_with("-simulator") => "watchsimulator",
|
("aarch64", "watchos") if llvm_target.ends_with("-simulator") => "watchsimulator",
|
||||||
("aarch64", "watchos") => "watchos",
|
("aarch64", "watchos") => "watchos",
|
||||||
|
("aarch64", "visionos") if llvm_target.ends_with("-simulator") => "xrsimulator",
|
||||||
|
("aarch64", "visionos") => "xros",
|
||||||
("arm", "watchos") => "watchos",
|
("arm", "watchos") => "watchos",
|
||||||
(_, "macos") => "macosx",
|
(_, "macos") => "macosx",
|
||||||
_ => {
|
_ => {
|
||||||
@ -3027,6 +3029,10 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result<String, errors::AppleSdkRootErro
|
|||||||
|| sdkroot.contains("MacOSX.platform") => {}
|
|| sdkroot.contains("MacOSX.platform") => {}
|
||||||
"watchsimulator"
|
"watchsimulator"
|
||||||
if sdkroot.contains("WatchOS.platform") || sdkroot.contains("MacOSX.platform") => {}
|
if sdkroot.contains("WatchOS.platform") || sdkroot.contains("MacOSX.platform") => {}
|
||||||
|
"visionos"
|
||||||
|
if sdkroot.contains("XROS.platform") || sdkroot.contains("MacOSX.platform") => {}
|
||||||
|
"visionossimulator"
|
||||||
|
if sdkroot.contains("XROS.platform") || sdkroot.contains("MacOSX.platform") => {}
|
||||||
// Ignore `SDKROOT` if it's not a valid path.
|
// Ignore `SDKROOT` if it's not a valid path.
|
||||||
_ if !p.is_absolute() || p == Path::new("/") || !p.exists() => {}
|
_ if !p.is_absolute() || p == Path::new("/") || !p.exists() => {}
|
||||||
_ => return Ok(sdkroot),
|
_ => return Ok(sdkroot),
|
||||||
|
@ -102,6 +102,7 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
|
|||||||
"ios" => ios_deployment_target(arch, abi),
|
"ios" => ios_deployment_target(arch, abi),
|
||||||
"tvos" => tvos_deployment_target(),
|
"tvos" => tvos_deployment_target(),
|
||||||
"watchos" => watchos_deployment_target(),
|
"watchos" => watchos_deployment_target(),
|
||||||
|
"visionos" => visionos_deployment_target(),
|
||||||
"macos" => macos_deployment_target(arch),
|
"macos" => macos_deployment_target(arch),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
@ -202,6 +203,8 @@ pub fn sdk_version(platform: u32) -> Option<(u32, u32)> {
|
|||||||
| object::macho::PLATFORM_TVOSSIMULATOR
|
| object::macho::PLATFORM_TVOSSIMULATOR
|
||||||
| object::macho::PLATFORM_MACCATALYST => Some((16, 2)),
|
| object::macho::PLATFORM_MACCATALYST => Some((16, 2)),
|
||||||
object::macho::PLATFORM_WATCHOS | object::macho::PLATFORM_WATCHOSSIMULATOR => Some((9, 1)),
|
object::macho::PLATFORM_WATCHOS | object::macho::PLATFORM_WATCHOSSIMULATOR => Some((9, 1)),
|
||||||
|
// FIXME: Upgrade to `object-rs` 0.33+ implementation with visionOS platform definition
|
||||||
|
11 | 12 => Some((1, 0)),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,6 +219,9 @@ pub fn platform(target: &Target) -> Option<u32> {
|
|||||||
("watchos", _) => object::macho::PLATFORM_WATCHOS,
|
("watchos", _) => object::macho::PLATFORM_WATCHOS,
|
||||||
("tvos", "sim") => object::macho::PLATFORM_TVOSSIMULATOR,
|
("tvos", "sim") => object::macho::PLATFORM_TVOSSIMULATOR,
|
||||||
("tvos", _) => object::macho::PLATFORM_TVOS,
|
("tvos", _) => object::macho::PLATFORM_TVOS,
|
||||||
|
// FIXME: Upgrade to `object-rs` 0.33+ implementation with visionOS platform definition
|
||||||
|
("visionos", "sim") => 12,
|
||||||
|
("visionos", _) => 11,
|
||||||
_ => return None,
|
_ => return None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -240,6 +246,7 @@ pub fn deployment_target(target: &Target) -> Option<(u32, u32)> {
|
|||||||
}
|
}
|
||||||
"watchos" => watchos_deployment_target(),
|
"watchos" => watchos_deployment_target(),
|
||||||
"tvos" => tvos_deployment_target(),
|
"tvos" => tvos_deployment_target(),
|
||||||
|
"visionos" => visionos_deployment_target(),
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -290,6 +297,7 @@ fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
|
|||||||
|| sdkroot.contains("AppleTVSimulator.platform")
|
|| sdkroot.contains("AppleTVSimulator.platform")
|
||||||
|| sdkroot.contains("WatchOS.platform")
|
|| sdkroot.contains("WatchOS.platform")
|
||||||
|| sdkroot.contains("WatchSimulator.platform")
|
|| sdkroot.contains("WatchSimulator.platform")
|
||||||
|
|| sdkroot.contains("XROS.platform")
|
||||||
{
|
{
|
||||||
env_remove.push("SDKROOT".into())
|
env_remove.push("SDKROOT".into())
|
||||||
}
|
}
|
||||||
@ -299,6 +307,7 @@ fn link_env_remove(os: &'static str) -> StaticCow<[StaticCow<str>]> {
|
|||||||
// although this is apparently ignored when using the linker at "/usr/bin/ld".
|
// although this is apparently ignored when using the linker at "/usr/bin/ld".
|
||||||
env_remove.push("IPHONEOS_DEPLOYMENT_TARGET".into());
|
env_remove.push("IPHONEOS_DEPLOYMENT_TARGET".into());
|
||||||
env_remove.push("TVOS_DEPLOYMENT_TARGET".into());
|
env_remove.push("TVOS_DEPLOYMENT_TARGET".into());
|
||||||
|
env_remove.push("XROS_DEPLOYMENT_TARGET".into());
|
||||||
env_remove.into()
|
env_remove.into()
|
||||||
} else {
|
} else {
|
||||||
// Otherwise if cross-compiling for a different OS/SDK (including Mac Catalyst), remove any part
|
// 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 {
|
|||||||
let (major, minor) = watchos_deployment_target();
|
let (major, minor) = watchos_deployment_target();
|
||||||
format!("{}-apple-watchos{}.{}.0-simulator", arch.target_name(), major, minor)
|
format!("{}-apple-watchos{}.{}.0-simulator", arch.target_name(), major, minor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visionos_deployment_target() -> (u32, u32) {
|
||||||
|
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
|
||||||
|
from_set_deployment_target("XROS_DEPLOYMENT_TARGET").unwrap_or((1, 0))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn visionos_llvm_target(arch: Arch) -> String {
|
||||||
|
let (major, minor) = visionos_deployment_target();
|
||||||
|
format!("{}-apple-visionos{}.{}.0", arch.target_name(), major, minor)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn visionos_sim_llvm_target(arch: Arch) -> String {
|
||||||
|
let (major, minor) = visionos_deployment_target();
|
||||||
|
format!("{}-apple-visionos{}.{}.0-simulator", arch.target_name(), major, minor)
|
||||||
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use crate::spec::targets::{
|
use crate::spec::targets::{
|
||||||
aarch64_apple_darwin, aarch64_apple_ios_sim, aarch64_apple_watchos_sim, i686_apple_darwin,
|
aarch64_apple_darwin, aarch64_apple_ios_sim, aarch64_apple_visionos_sim,
|
||||||
x86_64_apple_darwin, x86_64_apple_ios, x86_64_apple_tvos, x86_64_apple_watchos_sim,
|
aarch64_apple_watchos_sim, i686_apple_darwin, x86_64_apple_darwin, x86_64_apple_ios,
|
||||||
|
x86_64_apple_tvos, x86_64_apple_watchos_sim,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -12,6 +13,7 @@ fn simulator_targets_set_abi() {
|
|||||||
aarch64_apple_ios_sim::target(),
|
aarch64_apple_ios_sim::target(),
|
||||||
// Note: There is currently no ARM64 tvOS simulator target
|
// Note: There is currently no ARM64 tvOS simulator target
|
||||||
aarch64_apple_watchos_sim::target(),
|
aarch64_apple_watchos_sim::target(),
|
||||||
|
aarch64_apple_visionos_sim::target(),
|
||||||
];
|
];
|
||||||
|
|
||||||
for target in &all_sim_targets {
|
for target in &all_sim_targets {
|
||||||
@ -32,7 +34,11 @@ fn macos_link_environment_unmodified() {
|
|||||||
// for the host.
|
// for the host.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
target.link_env_remove,
|
target.link_env_remove,
|
||||||
crate::spec::cvs!["IPHONEOS_DEPLOYMENT_TARGET", "TVOS_DEPLOYMENT_TARGET"],
|
crate::spec::cvs![
|
||||||
|
"IPHONEOS_DEPLOYMENT_TARGET",
|
||||||
|
"TVOS_DEPLOYMENT_TARGET",
|
||||||
|
"XROS_DEPLOYMENT_TARGET"
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1557,6 +1557,9 @@ fn $module() {
|
|||||||
("aarch64-apple-watchos", aarch64_apple_watchos),
|
("aarch64-apple-watchos", aarch64_apple_watchos),
|
||||||
("aarch64-apple-watchos-sim", aarch64_apple_watchos_sim),
|
("aarch64-apple-watchos-sim", aarch64_apple_watchos_sim),
|
||||||
|
|
||||||
|
("aarch64-apple-visionos", aarch64_apple_visionos),
|
||||||
|
("aarch64-apple-visionos-sim", aarch64_apple_visionos_sim),
|
||||||
|
|
||||||
("armebv7r-none-eabi", armebv7r_none_eabi),
|
("armebv7r-none-eabi", armebv7r_none_eabi),
|
||||||
("armebv7r-none-eabihf", armebv7r_none_eabihf),
|
("armebv7r-none-eabihf", armebv7r_none_eabihf),
|
||||||
("armv7r-none-eabi", armv7r_none_eabi),
|
("armv7r-none-eabi", armv7r_none_eabi),
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
use crate::spec::base::apple::{opts, visionos_llvm_target, Arch};
|
||||||
|
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
|
||||||
|
|
||||||
|
pub fn target() -> Target {
|
||||||
|
let arch = Arch::Arm64;
|
||||||
|
let mut base = opts("visionos", arch);
|
||||||
|
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
|
||||||
|
|
||||||
|
Target {
|
||||||
|
llvm_target: visionos_llvm_target(arch).into(),
|
||||||
|
metadata: crate::spec::TargetMetadata {
|
||||||
|
description: Some("ARM64 Apple visionOS".into()),
|
||||||
|
tier: Some(3),
|
||||||
|
host_tools: Some(false),
|
||||||
|
std: Some(false),
|
||||||
|
},
|
||||||
|
pointer_width: 64,
|
||||||
|
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||||
|
arch: arch.target_arch(),
|
||||||
|
options: TargetOptions {
|
||||||
|
features: "+neon,+fp-armv8,+apple-a16".into(),
|
||||||
|
max_atomic_width: Some(128),
|
||||||
|
frame_pointer: FramePointer::NonLeaf,
|
||||||
|
..base
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
use crate::spec::base::apple::{opts, visionos_sim_llvm_target, Arch};
|
||||||
|
use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
|
||||||
|
|
||||||
|
pub fn target() -> Target {
|
||||||
|
let arch = Arch::Arm64_sim;
|
||||||
|
let mut base = opts("visionos", arch);
|
||||||
|
base.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::THREAD;
|
||||||
|
|
||||||
|
Target {
|
||||||
|
llvm_target: visionos_sim_llvm_target(arch).into(),
|
||||||
|
metadata: crate::spec::TargetMetadata {
|
||||||
|
description: Some("ARM64 Apple visionOS simulator".into()),
|
||||||
|
tier: Some(3),
|
||||||
|
host_tools: Some(false),
|
||||||
|
std: Some(false),
|
||||||
|
},
|
||||||
|
pointer_width: 64,
|
||||||
|
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(),
|
||||||
|
arch: arch.target_arch(),
|
||||||
|
options: TargetOptions {
|
||||||
|
features: "+neon,+fp-armv8,+apple-a16".into(),
|
||||||
|
max_atomic_width: Some(128),
|
||||||
|
frame_pointer: FramePointer::NonLeaf,
|
||||||
|
..base
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
@ -22,6 +22,7 @@ fn main() {
|
|||||||
|| target_os == "ios"
|
|| target_os == "ios"
|
||||||
|| target_os == "tvos"
|
|| target_os == "tvos"
|
||||||
|| target_os == "watchos"
|
|| target_os == "watchos"
|
||||||
|
|| target_os == "visionos"
|
||||||
|| target_os == "windows"
|
|| target_os == "windows"
|
||||||
|| target_os == "fuchsia"
|
|| target_os == "fuchsia"
|
||||||
|| (target_vendor == "fortanix" && target_env == "sgx")
|
|| (target_vendor == "fortanix" && target_env == "sgx")
|
||||||
|
@ -1644,8 +1644,8 @@ fn test_file_times() {
|
|||||||
use crate::os::macos::fs::FileTimesExt;
|
use crate::os::macos::fs::FileTimesExt;
|
||||||
#[cfg(target_os = "tvos")]
|
#[cfg(target_os = "tvos")]
|
||||||
use crate::os::tvos::fs::FileTimesExt;
|
use crate::os::tvos::fs::FileTimesExt;
|
||||||
#[cfg(target_os = "tvos")]
|
#[cfg(target_os = "visionos")]
|
||||||
use crate::os::tvos::fs::FileTimesExt;
|
use crate::os::visionos::fs::FileTimesExt;
|
||||||
#[cfg(target_os = "watchos")]
|
#[cfg(target_os = "watchos")]
|
||||||
use crate::os::watchos::fs::FileTimesExt;
|
use crate::os::watchos::fs::FileTimesExt;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
@ -1662,6 +1662,7 @@ fn test_file_times() {
|
|||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
))]
|
))]
|
||||||
let created = SystemTime::UNIX_EPOCH + Duration::from_secs(32123);
|
let created = SystemTime::UNIX_EPOCH + Duration::from_secs(32123);
|
||||||
@ -1670,6 +1671,7 @@ fn test_file_times() {
|
|||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
))]
|
))]
|
||||||
{
|
{
|
||||||
@ -1701,6 +1703,7 @@ fn test_file_times() {
|
|||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
))]
|
))]
|
||||||
{
|
{
|
||||||
@ -1709,7 +1712,13 @@ fn test_file_times() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
|
#[cfg(any(
|
||||||
|
target_os = "macos",
|
||||||
|
target_os = "ios",
|
||||||
|
target_os = "tvos",
|
||||||
|
target_os = "watchos",
|
||||||
|
target_os = "visionos"
|
||||||
|
))]
|
||||||
fn test_file_times_pre_epoch_with_nanos() {
|
fn test_file_times_pre_epoch_with_nanos() {
|
||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
use crate::os::ios::fs::FileTimesExt;
|
use crate::os::ios::fs::FileTimesExt;
|
||||||
@ -1717,6 +1726,8 @@ fn test_file_times_pre_epoch_with_nanos() {
|
|||||||
use crate::os::macos::fs::FileTimesExt;
|
use crate::os::macos::fs::FileTimesExt;
|
||||||
#[cfg(target_os = "tvos")]
|
#[cfg(target_os = "tvos")]
|
||||||
use crate::os::tvos::fs::FileTimesExt;
|
use crate::os::tvos::fs::FileTimesExt;
|
||||||
|
#[cfg(target_os = "visionos")]
|
||||||
|
use crate::os::visionos::fs::FileTimesExt;
|
||||||
#[cfg(target_os = "watchos")]
|
#[cfg(target_os = "watchos")]
|
||||||
use crate::os::watchos::fs::FileTimesExt;
|
use crate::os::watchos::fs::FileTimesExt;
|
||||||
|
|
||||||
|
@ -149,6 +149,8 @@ pub mod windows {}
|
|||||||
pub(crate) mod tvos;
|
pub(crate) mod tvos;
|
||||||
#[cfg(target_os = "uefi")]
|
#[cfg(target_os = "uefi")]
|
||||||
pub mod uefi;
|
pub mod uefi;
|
||||||
|
#[cfg(target_os = "visionos")]
|
||||||
|
pub(crate) mod visionos;
|
||||||
#[cfg(target_os = "vita")]
|
#[cfg(target_os = "vita")]
|
||||||
pub mod vita;
|
pub mod vita;
|
||||||
#[cfg(target_os = "vxworks")]
|
#[cfg(target_os = "vxworks")]
|
||||||
|
@ -79,6 +79,8 @@ mod platform {
|
|||||||
pub use crate::os::solaris::*;
|
pub use crate::os::solaris::*;
|
||||||
#[cfg(target_os = "tvos")]
|
#[cfg(target_os = "tvos")]
|
||||||
pub use crate::os::tvos::*;
|
pub use crate::os::tvos::*;
|
||||||
|
#[cfg(target_os = "visionos")]
|
||||||
|
pub use crate::os::visionos::*;
|
||||||
#[cfg(target_os = "vita")]
|
#[cfg(target_os = "vita")]
|
||||||
pub use crate::os::vita::*;
|
pub use crate::os::vita::*;
|
||||||
#[cfg(target_os = "vxworks")]
|
#[cfg(target_os = "vxworks")]
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
@ -46,6 +47,7 @@
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "nto"
|
target_os = "nto"
|
||||||
@ -234,6 +235,7 @@ pub fn peer_addr(&self) -> io::Result<SocketAddr> {
|
|||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "nto"
|
target_os = "nto"
|
||||||
|
@ -35,7 +35,13 @@ pub struct UCred {
|
|||||||
))]
|
))]
|
||||||
pub(super) use self::impl_bsd::peer_cred;
|
pub(super) use self::impl_bsd::peer_cred;
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
|
#[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;
|
pub(super) use self::impl_mac::peer_cred;
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
@ -97,7 +103,13 @@ pub fn peer_cred(socket: &UnixStream) -> io::Result<UCred> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
|
#[cfg(any(
|
||||||
|
target_os = "macos",
|
||||||
|
target_os = "ios",
|
||||||
|
target_os = "tvos",
|
||||||
|
target_os = "watchos",
|
||||||
|
target_os = "visionos"
|
||||||
|
))]
|
||||||
mod impl_mac {
|
mod impl_mac {
|
||||||
use super::UCred;
|
use super::UCred;
|
||||||
use crate::os::unix::io::AsRawFd;
|
use crate::os::unix::io::AsRawFd;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "openbsd"
|
target_os = "openbsd"
|
||||||
))]
|
))]
|
||||||
fn test_socket_pair() {
|
fn test_socket_pair() {
|
||||||
@ -32,6 +33,7 @@ fn test_socket_pair() {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
))]
|
))]
|
||||||
fn test_socket_pair_pids(arg: Type) -> RetType {
|
fn test_socket_pair_pids(arg: Type) -> RetType {
|
||||||
|
160
library/std/src/os/visionos/fs.rs
Normal file
160
library/std/src/os/visionos/fs.rs
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
#![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
|
||||||
|
}
|
||||||
|
}
|
6
library/std/src/os/visionos/mod.rs
Normal file
6
library/std/src/os/visionos/mod.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
//! visionos-specific definitions
|
||||||
|
|
||||||
|
#![stable(feature = "raw_ext", since = "1.1.0")]
|
||||||
|
|
||||||
|
pub mod fs;
|
||||||
|
pub mod raw;
|
83
library/std/src/os/visionos/raw.rs
Normal file
83
library/std/src/os/visionos/raw.rs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
//! 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],
|
||||||
|
}
|
@ -170,7 +170,13 @@ fn clone() -> Vec<OsString> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
|
#[cfg(any(
|
||||||
|
target_os = "macos",
|
||||||
|
target_os = "ios",
|
||||||
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
|
target_os = "tvos"
|
||||||
|
))]
|
||||||
mod imp {
|
mod imp {
|
||||||
use super::Args;
|
use super::Args;
|
||||||
use crate::ffi::CStr;
|
use crate::ffi::CStr;
|
||||||
@ -211,7 +217,12 @@ pub fn args() -> Args {
|
|||||||
// for i in (0..[args count])
|
// for i in (0..[args count])
|
||||||
// res.push([args objectAtIndex:i])
|
// res.push([args objectAtIndex:i])
|
||||||
// res
|
// res
|
||||||
#[cfg(any(target_os = "ios", target_os = "tvos", target_os = "watchos"))]
|
#[cfg(any(
|
||||||
|
target_os = "ios",
|
||||||
|
target_os = "tvos",
|
||||||
|
target_os = "watchos",
|
||||||
|
target_os = "visionos"
|
||||||
|
))]
|
||||||
pub fn args() -> Args {
|
pub fn args() -> Args {
|
||||||
use crate::ffi::{c_char, c_void, OsString};
|
use crate::ffi::{c_char, c_void, OsString};
|
||||||
use crate::mem;
|
use crate::mem;
|
||||||
|
@ -53,6 +53,17 @@ pub mod os {
|
|||||||
pub const EXE_EXTENSION: &str = "";
|
pub const EXE_EXTENSION: &str = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "visionos")]
|
||||||
|
pub mod os {
|
||||||
|
pub const FAMILY: &str = "unix";
|
||||||
|
pub const OS: &str = "visionos";
|
||||||
|
pub const DLL_PREFIX: &str = "lib";
|
||||||
|
pub const DLL_SUFFIX: &str = ".dylib";
|
||||||
|
pub const DLL_EXTENSION: &str = "dylib";
|
||||||
|
pub const EXE_SUFFIX: &str = "";
|
||||||
|
pub const EXE_EXTENSION: &str = "";
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "freebsd")]
|
#[cfg(target_os = "freebsd")]
|
||||||
pub mod os {
|
pub mod os {
|
||||||
pub const FAMILY: &str = "unix";
|
pub const FAMILY: &str = "unix";
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
))]
|
))]
|
||||||
const fn max_iov() -> usize {
|
const fn max_iov() -> usize {
|
||||||
libc::IOV_MAX as usize
|
libc::IOV_MAX as usize
|
||||||
@ -81,6 +82,7 @@ const fn max_iov() -> usize {
|
|||||||
target_os = "horizon",
|
target_os = "horizon",
|
||||||
target_os = "vita",
|
target_os = "vita",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
)))]
|
)))]
|
||||||
const fn max_iov() -> usize {
|
const fn max_iov() -> usize {
|
||||||
16 // The minimum value required by POSIX.
|
16 // The minimum value required by POSIX.
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
))]
|
))]
|
||||||
use crate::sys::weak::syscall;
|
use crate::sys::weak::syscall;
|
||||||
#[cfg(any(target_os = "android", target_os = "macos", target_os = "solaris"))]
|
#[cfg(any(target_os = "android", target_os = "macos", target_os = "solaris"))]
|
||||||
@ -35,6 +36,7 @@
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "solaris",
|
target_os = "solaris",
|
||||||
all(target_os = "linux", target_env = "gnu")
|
all(target_os = "linux", target_env = "gnu")
|
||||||
))]
|
))]
|
||||||
@ -377,7 +379,13 @@ pub struct FilePermissions {
|
|||||||
pub struct FileTimes {
|
pub struct FileTimes {
|
||||||
accessed: Option<SystemTime>,
|
accessed: Option<SystemTime>,
|
||||||
modified: Option<SystemTime>,
|
modified: Option<SystemTime>,
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos"))]
|
#[cfg(any(
|
||||||
|
target_os = "macos",
|
||||||
|
target_os = "ios",
|
||||||
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
|
target_os = "tvos"
|
||||||
|
))]
|
||||||
created: Option<SystemTime>,
|
created: Option<SystemTime>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,6 +563,7 @@ pub fn accessed(&self) -> io::Result<SystemTime> {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
))]
|
))]
|
||||||
pub fn created(&self) -> io::Result<SystemTime> {
|
pub fn created(&self) -> io::Result<SystemTime> {
|
||||||
SystemTime::new(self.stat.st_birthtime as i64, self.stat.st_birthtime_nsec as i64)
|
SystemTime::new(self.stat.st_birthtime as i64, self.stat.st_birthtime_nsec as i64)
|
||||||
@ -567,6 +576,7 @@ pub fn created(&self) -> io::Result<SystemTime> {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "vita",
|
target_os = "vita",
|
||||||
)))]
|
)))]
|
||||||
pub fn created(&self) -> io::Result<SystemTime> {
|
pub fn created(&self) -> io::Result<SystemTime> {
|
||||||
@ -647,7 +657,13 @@ pub fn set_modified(&mut self, t: SystemTime) {
|
|||||||
self.modified = Some(t);
|
self.modified = Some(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos"))]
|
#[cfg(any(
|
||||||
|
target_os = "macos",
|
||||||
|
target_os = "ios",
|
||||||
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
|
target_os = "tvos"
|
||||||
|
))]
|
||||||
pub fn set_created(&mut self, t: SystemTime) {
|
pub fn set_created(&mut self, t: SystemTime) {
|
||||||
self.created = Some(t);
|
self.created = Some(t);
|
||||||
}
|
}
|
||||||
@ -938,6 +954,7 @@ pub fn file_type(&self) -> io::Result<FileType> {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
target_os = "emscripten",
|
target_os = "emscripten",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
@ -974,6 +991,7 @@ pub fn ino(&self) -> u64 {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
@ -993,6 +1011,7 @@ fn name_bytes(&self) -> &[u8] {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
@ -1162,6 +1181,7 @@ pub fn fsync(&self) -> io::Result<()> {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
))]
|
))]
|
||||||
unsafe fn os_fsync(fd: c_int) -> c_int {
|
unsafe fn os_fsync(fd: c_int) -> c_int {
|
||||||
libc::fcntl(fd, libc::F_FULLFSYNC)
|
libc::fcntl(fd, libc::F_FULLFSYNC)
|
||||||
@ -1171,6 +1191,7 @@ unsafe fn os_fsync(fd: c_int) -> c_int {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
)))]
|
)))]
|
||||||
unsafe fn os_fsync(fd: c_int) -> c_int {
|
unsafe fn os_fsync(fd: c_int) -> c_int {
|
||||||
libc::fsync(fd)
|
libc::fsync(fd)
|
||||||
@ -1186,6 +1207,7 @@ pub fn datasync(&self) -> io::Result<()> {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
))]
|
))]
|
||||||
unsafe fn os_datasync(fd: c_int) -> c_int {
|
unsafe fn os_datasync(fd: c_int) -> c_int {
|
||||||
libc::fcntl(fd, libc::F_FULLFSYNC)
|
libc::fcntl(fd, libc::F_FULLFSYNC)
|
||||||
@ -1212,6 +1234,7 @@ unsafe fn os_datasync(fd: c_int) -> c_int {
|
|||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "nto",
|
target_os = "nto",
|
||||||
target_os = "hurd",
|
target_os = "hurd",
|
||||||
)))]
|
)))]
|
||||||
@ -1322,7 +1345,7 @@ pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
|
|||||||
io::ErrorKind::Unsupported,
|
io::ErrorKind::Unsupported,
|
||||||
"setting file times not supported",
|
"setting file times not supported",
|
||||||
))
|
))
|
||||||
} else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))] {
|
} else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))] {
|
||||||
let mut buf = [mem::MaybeUninit::<libc::timespec>::uninit(); 3];
|
let mut buf = [mem::MaybeUninit::<libc::timespec>::uninit(); 3];
|
||||||
let mut num_times = 0;
|
let mut num_times = 0;
|
||||||
let mut attrlist: libc::attrlist = unsafe { mem::zeroed() };
|
let mut attrlist: libc::attrlist = unsafe { mem::zeroed() };
|
||||||
@ -1787,6 +1810,7 @@ fn open_to_and_set_permissions(
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
)))]
|
)))]
|
||||||
pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
|
pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
|
||||||
let (mut reader, reader_metadata) = open_from(from)?;
|
let (mut reader, reader_metadata) = open_from(from)?;
|
||||||
@ -1813,7 +1837,13 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
|
#[cfg(any(
|
||||||
|
target_os = "macos",
|
||||||
|
target_os = "ios",
|
||||||
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
|
target_os = "tvos"
|
||||||
|
))]
|
||||||
pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
|
pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
|
||||||
use crate::sync::atomic::{AtomicBool, Ordering};
|
use crate::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ unsafe fn sanitize_standard_fds() {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
target_os = "l4re",
|
target_os = "l4re",
|
||||||
target_os = "horizon",
|
target_os = "horizon",
|
||||||
@ -405,7 +406,7 @@ pub fn abort_internal() -> ! {
|
|||||||
} else if #[cfg(target_os = "macos")] {
|
} else if #[cfg(target_os = "macos")] {
|
||||||
#[link(name = "System")]
|
#[link(name = "System")]
|
||||||
extern "C" {}
|
extern "C" {}
|
||||||
} else if #[cfg(any(target_os = "ios", target_os = "tvos", target_os = "watchos"))] {
|
} else if #[cfg(any(target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))] {
|
||||||
#[link(name = "System")]
|
#[link(name = "System")]
|
||||||
#[link(name = "objc")]
|
#[link(name = "objc")]
|
||||||
#[link(name = "Foundation", kind = "framework")]
|
#[link(name = "Foundation", kind = "framework")]
|
||||||
|
@ -69,7 +69,8 @@
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "watchos"
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
),
|
),
|
||||||
link_name = "__error"
|
link_name = "__error"
|
||||||
)]
|
)]
|
||||||
@ -430,7 +431,13 @@ pub fn current_exe() -> io::Result<PathBuf> {
|
|||||||
Ok(PathBuf::from(OsString::from_vec(e)))
|
Ok(PathBuf::from(OsString::from_vec(e)))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
|
#[cfg(any(
|
||||||
|
target_os = "macos",
|
||||||
|
target_os = "ios",
|
||||||
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
|
target_os = "tvos"
|
||||||
|
))]
|
||||||
pub fn current_exe() -> io::Result<PathBuf> {
|
pub fn current_exe() -> io::Result<PathBuf> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut sz: u32 = 0;
|
let mut sz: u32 = 0;
|
||||||
@ -699,6 +706,7 @@ pub fn home_dir() -> Option<PathBuf> {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "emscripten",
|
target_os = "emscripten",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
target_os = "vxworks",
|
target_os = "vxworks",
|
||||||
@ -714,6 +722,7 @@ unsafe fn fallback() -> Option<OsString> {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "emscripten",
|
target_os = "emscripten",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
target_os = "vxworks",
|
target_os = "vxworks",
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
all(target_os = "linux", target_env = "gnu"),
|
all(target_os = "linux", target_env = "gnu"),
|
||||||
|
@ -16,6 +16,7 @@ pub fn hashmap_random_keys() -> (u64, u64) {
|
|||||||
not(target_os = "ios"),
|
not(target_os = "ios"),
|
||||||
not(target_os = "tvos"),
|
not(target_os = "tvos"),
|
||||||
not(target_os = "watchos"),
|
not(target_os = "watchos"),
|
||||||
|
not(target_os = "visionos"),
|
||||||
not(target_os = "openbsd"),
|
not(target_os = "openbsd"),
|
||||||
not(target_os = "netbsd"),
|
not(target_os = "netbsd"),
|
||||||
not(target_os = "fuchsia"),
|
not(target_os = "fuchsia"),
|
||||||
|
@ -150,7 +150,13 @@ pub fn set_name(name: &CStr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))]
|
#[cfg(any(
|
||||||
|
target_os = "macos",
|
||||||
|
target_os = "ios",
|
||||||
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
|
target_os = "tvos"
|
||||||
|
))]
|
||||||
pub fn set_name(name: &CStr) {
|
pub fn set_name(name: &CStr) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let name = truncate_cstr::<{ libc::MAXTHREADNAMESIZE }>(name);
|
let name = truncate_cstr::<{ libc::MAXTHREADNAMESIZE }>(name);
|
||||||
@ -371,6 +377,7 @@ fn drop(&mut self) {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "nto",
|
target_os = "nto",
|
||||||
target_os = "solaris",
|
target_os = "solaris",
|
||||||
target_os = "illumos",
|
target_os = "illumos",
|
||||||
|
@ -76,7 +76,13 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
|
|||||||
// workaround below is to register, via _tlv_atexit, a custom DTOR list once per
|
// workaround below is to register, via _tlv_atexit, a custom DTOR list once per
|
||||||
// thread. thread_local dtors are pushed to the DTOR list without calling
|
// thread. thread_local dtors are pushed to the DTOR list without calling
|
||||||
// _tlv_atexit.
|
// _tlv_atexit.
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos"))]
|
#[cfg(any(
|
||||||
|
target_os = "macos",
|
||||||
|
target_os = "ios",
|
||||||
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
|
target_os = "tvos"
|
||||||
|
))]
|
||||||
pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
|
pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
|
||||||
use crate::cell::{Cell, RefCell};
|
use crate::cell::{Cell, RefCell};
|
||||||
use crate::ptr;
|
use crate::ptr;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
),
|
),
|
||||||
not(miri),
|
not(miri),
|
||||||
|
@ -48,6 +48,7 @@ unsafe fn wait_timeout(
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "espidf",
|
target_os = "espidf",
|
||||||
target_os = "horizon",
|
target_os = "horizon",
|
||||||
))]
|
))]
|
||||||
@ -76,6 +77,7 @@ unsafe fn wait_timeout(
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "espidf",
|
target_os = "espidf",
|
||||||
target_os = "horizon",
|
target_os = "horizon",
|
||||||
)))]
|
)))]
|
||||||
@ -124,6 +126,7 @@ pub unsafe fn new_in_place(parker: *mut Parker) {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "l4re",
|
target_os = "l4re",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "redox",
|
target_os = "redox",
|
||||||
|
@ -90,7 +90,8 @@ const fn new(tv_sec: i64, tv_nsec: i64) -> Result<Timespec, io::Error> {
|
|||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos"
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
))]
|
))]
|
||||||
let (tv_sec, tv_nsec) =
|
let (tv_sec, tv_nsec) =
|
||||||
if (tv_sec <= 0 && tv_sec > i64::MIN) && (tv_nsec < 0 && tv_nsec > -1_000_000_000) {
|
if (tv_sec <= 0 && tv_sec > i64::MIN) && (tv_nsec < 0 && tv_nsec > -1_000_000_000) {
|
||||||
@ -278,6 +279,7 @@ pub fn now() -> Instant {
|
|||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "tvos"
|
target_os = "tvos"
|
||||||
))]
|
))]
|
||||||
const clock_id: libc::clockid_t = libc::CLOCK_UPTIME_RAW;
|
const clock_id: libc::clockid_t = libc::CLOCK_UPTIME_RAW;
|
||||||
@ -285,6 +287,7 @@ pub fn now() -> Instant {
|
|||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "tvos"
|
target_os = "tvos"
|
||||||
)))]
|
)))]
|
||||||
const clock_id: libc::clockid_t = libc::CLOCK_MONOTONIC;
|
const clock_id: libc::clockid_t = libc::CLOCK_MONOTONIC;
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
// https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c
|
// https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(all(target_arch = "arm", not(target_os = "ios"), not(target_os = "tvos"), not(target_os = "watchos"), not(target_os = "netbsd")))] {
|
if #[cfg(all(target_arch = "arm", not(target_os = "ios"), not(target_os = "tvos"), not(target_os = "watchos"), not(target_os = "visionos"), not(target_os = "netbsd")))] {
|
||||||
// ARM EHABI personality routine.
|
// ARM EHABI personality routine.
|
||||||
// https://web.archive.org/web/20190728160938/https://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf
|
// https://web.archive.org/web/20190728160938/https://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf
|
||||||
//
|
//
|
||||||
|
@ -34,6 +34,7 @@ fn init() -> Box<Self> {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "l4re",
|
target_os = "l4re",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "redox"
|
target_os = "redox"
|
||||||
@ -127,6 +128,7 @@ pub unsafe fn wait(&self, mutex: &Mutex) {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "espidf",
|
target_os = "espidf",
|
||||||
target_os = "horizon"
|
target_os = "horizon"
|
||||||
@ -162,6 +164,7 @@ pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos",
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "espidf",
|
target_os = "espidf",
|
||||||
target_os = "horizon"
|
target_os = "horizon"
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(any(
|
if #[cfg(any(
|
||||||
target_os = "dragonfly", target_os = "freebsd",
|
target_os = "dragonfly", target_os = "freebsd",
|
||||||
target_os = "ios", target_os = "tvos", target_os = "macos", target_os = "watchos",
|
target_os = "ios", target_os = "tvos", target_os = "macos", target_os = "watchos", target_os = "visionos",
|
||||||
target_os = "openbsd", target_os = "netbsd", target_os = "illumos",
|
target_os = "openbsd", target_os = "netbsd", target_os = "illumos",
|
||||||
target_os = "solaris", target_os = "haiku", target_os = "l4re", target_os = "nto"))] {
|
target_os = "solaris", target_os = "haiku", target_os = "l4re", target_os = "nto"))] {
|
||||||
use crate::sys::net::netc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP;
|
use crate::sys::net::netc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP;
|
||||||
|
@ -43,7 +43,8 @@ fn test_named_thread() {
|
|||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "tvos",
|
target_os = "tvos",
|
||||||
target_os = "watchos"
|
target_os = "watchos",
|
||||||
|
target_os = "visionos",
|
||||||
))]
|
))]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_named_thread_truncation() {
|
fn test_named_thread_truncation() {
|
||||||
|
@ -123,7 +123,7 @@ pub enum _Unwind_Context {}
|
|||||||
}
|
}
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(any(target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "netbsd", not(target_arch = "arm")))] {
|
if #[cfg(any(target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos", target_os = "netbsd", not(target_arch = "arm")))] {
|
||||||
// Not ARM EHABI
|
// Not ARM EHABI
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, PartialEq)]
|
#[derive(Copy, Clone, PartialEq)]
|
||||||
|
@ -365,10 +365,11 @@ fn run(self, builder: &Builder<'_>) -> LlvmResult {
|
|||||||
cfg.define("LLVM_ENABLE_ZLIB", "OFF");
|
cfg.define("LLVM_ENABLE_ZLIB", "OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are we compiling for iOS/tvOS/watchOS?
|
// Are we compiling for iOS/tvOS/watchOS/visionOS?
|
||||||
if target.contains("apple-ios")
|
if target.contains("apple-ios")
|
||||||
|| target.contains("apple-tvos")
|
|| target.contains("apple-tvos")
|
||||||
|| target.contains("apple-watchos")
|
|| target.contains("apple-watchos")
|
||||||
|
|| target.contains("apple-visionos")
|
||||||
{
|
{
|
||||||
// These two defines prevent CMake from automatically trying to add a MacOSX sysroot, which leads to a compiler error.
|
// These two defines prevent CMake from automatically trying to add a MacOSX sysroot, which leads to a compiler error.
|
||||||
cfg.define("CMAKE_OSX_SYSROOT", "/");
|
cfg.define("CMAKE_OSX_SYSROOT", "/");
|
||||||
|
@ -92,8 +92,9 @@
|
|||||||
(Some(Mode::Std), "backtrace_in_libstd", None),
|
(Some(Mode::Std), "backtrace_in_libstd", None),
|
||||||
/* Extra values not defined in the built-in targets yet, but used in std */
|
/* Extra values not defined in the built-in targets yet, but used in std */
|
||||||
(Some(Mode::Std), "target_env", Some(&["libnx", "p2"])),
|
(Some(Mode::Std), "target_env", Some(&["libnx", "p2"])),
|
||||||
// (Some(Mode::Std), "target_os", Some(&[])),
|
(Some(Mode::Std), "target_os", Some(&["visionos"])),
|
||||||
(Some(Mode::Std), "target_arch", Some(&["arm64ec", "spirv", "nvptx", "xtensa"])),
|
(Some(Mode::Std), "target_arch", Some(&["arm64ec", "spirv", "nvptx", "xtensa"])),
|
||||||
|
(Some(Mode::ToolStd), "target_os", Some(&["visionos"])),
|
||||||
/* Extra names used by dependencies */
|
/* Extra names used by dependencies */
|
||||||
// FIXME: Used by serde_json, but we should not be triggering on external dependencies.
|
// FIXME: Used by serde_json, but we should not be triggering on external dependencies.
|
||||||
(Some(Mode::Rustc), "no_btreemap_remove_entry", None),
|
(Some(Mode::Rustc), "no_btreemap_remove_entry", None),
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
- [arm64ec-pc-windows-msvc](platform-support/arm64ec-pc-windows-msvc.md)
|
- [arm64ec-pc-windows-msvc](platform-support/arm64ec-pc-windows-msvc.md)
|
||||||
- [\*-apple-tvos](platform-support/apple-tvos.md)
|
- [\*-apple-tvos](platform-support/apple-tvos.md)
|
||||||
- [\*-apple-watchos\*](platform-support/apple-watchos.md)
|
- [\*-apple-watchos\*](platform-support/apple-watchos.md)
|
||||||
|
- [aarch64-apple-visionos\*](platform-support/apple-visionos.md)
|
||||||
- [aarch64-nintendo-switch-freestanding](platform-support/aarch64-nintendo-switch-freestanding.md)
|
- [aarch64-nintendo-switch-freestanding](platform-support/aarch64-nintendo-switch-freestanding.md)
|
||||||
- [armeb-unknown-linux-gnueabi](platform-support/armeb-unknown-linux-gnueabi.md)
|
- [armeb-unknown-linux-gnueabi](platform-support/armeb-unknown-linux-gnueabi.md)
|
||||||
- [arm-none-eabi](platform-support/arm-none-eabi.md)
|
- [arm-none-eabi](platform-support/arm-none-eabi.md)
|
||||||
|
@ -243,6 +243,8 @@ target | std | host | notes
|
|||||||
[`aarch64-apple-tvos-sim`](platform-support/apple-tvos.md) | ? | | ARM64 tvOS Simulator
|
[`aarch64-apple-tvos-sim`](platform-support/apple-tvos.md) | ? | | ARM64 tvOS Simulator
|
||||||
[`aarch64-apple-watchos`](platform-support/apple-watchos.md) | ✓ | | ARM64 Apple WatchOS
|
[`aarch64-apple-watchos`](platform-support/apple-watchos.md) | ✓ | | ARM64 Apple WatchOS
|
||||||
[`aarch64-apple-watchos-sim`](platform-support/apple-watchos.md) | ✓ | | ARM64 Apple WatchOS Simulator
|
[`aarch64-apple-watchos-sim`](platform-support/apple-watchos.md) | ✓ | | ARM64 Apple WatchOS Simulator
|
||||||
|
[`aarch64-apple-visionos`](platform-support/apple-visionos.md) | ✓ | | ARM64 Apple visionOS
|
||||||
|
[`aarch64-apple-visionos-sim`](platform-support/apple-visionos.md) | ✓ | | ARM64 Apple visionOS Simulator
|
||||||
[`aarch64-kmc-solid_asp3`](platform-support/kmc-solid.md) | ✓ | | ARM64 SOLID with TOPPERS/ASP3
|
[`aarch64-kmc-solid_asp3`](platform-support/kmc-solid.md) | ✓ | | ARM64 SOLID with TOPPERS/ASP3
|
||||||
[`aarch64-nintendo-switch-freestanding`](platform-support/aarch64-nintendo-switch-freestanding.md) | * | | ARM64 Nintendo Switch, Horizon
|
[`aarch64-nintendo-switch-freestanding`](platform-support/aarch64-nintendo-switch-freestanding.md) | * | | ARM64 Nintendo Switch, Horizon
|
||||||
[`aarch64-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | ✓ |
|
[`aarch64-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | ✓ |
|
||||||
|
53
src/doc/rustc/src/platform-support/apple-visionos.md
Normal file
53
src/doc/rustc/src/platform-support/apple-visionos.md
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# aarch64-apple-visionos\*
|
||||||
|
|
||||||
|
- aarch64-apple-visionos
|
||||||
|
- aarch64-apple-visionos-sim
|
||||||
|
|
||||||
|
**Tier: 3**
|
||||||
|
|
||||||
|
Apple visionOS targets:
|
||||||
|
|
||||||
|
- Apple visionOS on arm64
|
||||||
|
- Apple visionOS Simulator on arm64
|
||||||
|
|
||||||
|
## Target maintainers
|
||||||
|
|
||||||
|
- [@agg23](https://github.com/agg23)
|
||||||
|
- [@madsmtm](https://github.com/madsmtm)
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
These targets are cross-compiled.
|
||||||
|
To build these targets Xcode 15 or higher on macOS is required, along with LLVM 18.
|
||||||
|
|
||||||
|
## Building the target
|
||||||
|
|
||||||
|
The targets can be built by enabling them for a `rustc` build, for example:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[build]
|
||||||
|
build-stage = 1
|
||||||
|
target = ["aarch64-apple-visionos-sim"]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building Rust programs
|
||||||
|
|
||||||
|
_Note: Building for this target requires the corresponding visionOS SDK, as provided by Xcode 15+._
|
||||||
|
|
||||||
|
Rust programs can be built for these targets, if `rustc` has been built with support for them, for example:
|
||||||
|
|
||||||
|
```text
|
||||||
|
rustc --target aarch64-apple-visionos-sim your-code.rs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
There is no support for running the Rust testsuite on visionOS or the simulators.
|
||||||
|
|
||||||
|
There is no easy way to run simple programs on visionOS or the visionOS simulators. Static library builds can be embedded into visionOS applications.
|
||||||
|
|
||||||
|
## Cross-compilation toolchains and C code
|
||||||
|
|
||||||
|
This target can be cross-compiled from x86_64 or aarch64 macOS hosts.
|
||||||
|
|
||||||
|
Other hosts are not supported for cross-compilation, but might work when also providing the required Xcode SDK.
|
@ -511,6 +511,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|||||||
"wasi" => "WASI",
|
"wasi" => "WASI",
|
||||||
"watchos" => "watchOS",
|
"watchos" => "watchOS",
|
||||||
"windows" => "Windows",
|
"windows" => "Windows",
|
||||||
|
"visionos" => "visionOS",
|
||||||
_ => "",
|
_ => "",
|
||||||
},
|
},
|
||||||
(sym::target_arch, Some(arch)) => match arch.as_str() {
|
(sym::target_arch, Some(arch)) => match arch.as_str() {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/// on the number of cores available.
|
/// on the number of cores available.
|
||||||
///
|
///
|
||||||
/// This fixes issue #7772.
|
/// This fixes issue #7772.
|
||||||
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
|
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "visionos"))]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub unsafe fn raise_fd_limit() {
|
pub unsafe fn raise_fd_limit() {
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
@ -27,6 +27,14 @@
|
|||||||
//@ revisions: arm64_32_apple_watchos
|
//@ revisions: arm64_32_apple_watchos
|
||||||
//@ [arm64_32_apple_watchos] compile-flags: --target arm64_32-apple-watchos
|
//@ [arm64_32_apple_watchos] compile-flags: --target arm64_32-apple-watchos
|
||||||
//@ [arm64_32_apple_watchos] needs-llvm-components: aarch64
|
//@ [arm64_32_apple_watchos] needs-llvm-components: aarch64
|
||||||
|
//@ revisions: aarch64_apple_visionos
|
||||||
|
//@ [aarch64_apple_visionos] min-llvm-version: 18
|
||||||
|
//@ [aarch64_apple_visionos] compile-flags: --target aarch64-apple-visionos
|
||||||
|
//@ [aarch64_apple_visionos] needs-llvm-components: aarch64
|
||||||
|
//@ revisions: aarch64_apple_visionos_sim
|
||||||
|
//@ [aarch64_apple_visionos_sim] min-llvm-version: 18
|
||||||
|
//@ [aarch64_apple_visionos_sim] compile-flags: --target aarch64-apple-visionos-sim
|
||||||
|
//@ [aarch64_apple_visionos_sim] needs-llvm-components: aarch64
|
||||||
//@ revisions: arm64e_apple_darwin
|
//@ revisions: arm64e_apple_darwin
|
||||||
//@ [arm64e_apple_darwin] compile-flags: --target arm64e-apple-darwin
|
//@ [arm64e_apple_darwin] compile-flags: --target arm64e-apple-darwin
|
||||||
//@ [arm64e_apple_darwin] needs-llvm-components: aarch64
|
//@ [arm64e_apple_darwin] needs-llvm-components: aarch64
|
||||||
|
@ -190,7 +190,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
|||||||
LL | target_os = "_UNEXPECTED_VALUE",
|
LL | target_os = "_UNEXPECTED_VALUE",
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, `zkvm`
|
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, `zkvm`
|
||||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||||
|
|
||||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||||
@ -263,7 +263,7 @@ LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux`
|
|||||||
| |
|
| |
|
||||||
| help: there is a expected value with a similar name: `"linux"`
|
| help: there is a expected value with a similar name: `"linux"`
|
||||||
|
|
|
|
||||||
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, `zkvm`
|
= note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, `zkvm`
|
||||||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
|
||||||
|
|
||||||
warning: 27 warnings emitted
|
warning: 27 warnings emitted
|
||||||
|
@ -286,6 +286,11 @@ trigger_files = [
|
|||||||
"library/std/src/os/windows"
|
"library/std/src/os/windows"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[autolabel."O-visionos"]
|
||||||
|
trigger_files = [
|
||||||
|
"library/std/src/os/visionos"
|
||||||
|
]
|
||||||
|
|
||||||
[autolabel."T-bootstrap"]
|
[autolabel."T-bootstrap"]
|
||||||
trigger_files = [
|
trigger_files = [
|
||||||
"x.py",
|
"x.py",
|
||||||
|
Loading…
Reference in New Issue
Block a user