diff options
| author | Mads Marquart <mads@marquart.dk> | 2024-09-07 14:13:02 +0200 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2024-09-14 04:25:01 +0100 |
| commit | 8a511191a0cf9290270e1a0f25bb0c26f9a56077 (patch) | |
| tree | 672e26023a2a23c47dfe6fd8f9467b0ab4ef464a /library/stdarch/crates/std_detect/src | |
| parent | 0fb034979a007363ba3237431934a16a165765de (diff) | |
| download | rust-8a511191a0cf9290270e1a0f25bb0c26f9a56077.tar.gz rust-8a511191a0cf9290270e1a0f25bb0c26f9a56077.zip | |
Enable feature detection on all Apple/Darwin targets
Tested in the simulator and on the device I had lying around, a 1st generation iPad Mini (which isn't Aarch64, but shows that the `sysctlbyname` calls still work even there, even if they return false). `sysctlbyname` _should_ be safe to use without causing rejections from the app store, as its usage is documented in: https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics Also, the standard library will use these soon anyhow, so this shouldn't affect the situation: https://github.com/rust-lang/rust/pull/129019
Diffstat (limited to 'library/stdarch/crates/std_detect/src')
| -rw-r--r-- | library/stdarch/crates/std_detect/src/detect/mod.rs | 4 | ||||
| -rw-r--r-- | library/stdarch/crates/std_detect/src/detect/os/darwin/aarch64.rs (renamed from library/stdarch/crates/std_detect/src/detect/os/macos/aarch64.rs) | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/library/stdarch/crates/std_detect/src/detect/mod.rs b/library/stdarch/crates/std_detect/src/detect/mod.rs index ae86ca987ee..ab247a303ed 100644 --- a/library/stdarch/crates/std_detect/src/detect/mod.rs +++ b/library/stdarch/crates/std_detect/src/detect/mod.rs @@ -66,8 +66,8 @@ cfg_if! { } else if #[cfg(all(target_os = "windows", any(target_arch = "aarch64", target_arch = "arm64ec")))] { #[path = "os/windows/aarch64.rs"] mod os; - } else if #[cfg(all(target_os = "macos", target_arch = "aarch64", feature = "libc"))] { - #[path = "os/macos/aarch64.rs"] + } else if #[cfg(all(target_vendor = "apple", target_arch = "aarch64", feature = "libc"))] { + #[path = "os/darwin/aarch64.rs"] mod os; } else { #[path = "os/other.rs"] diff --git a/library/stdarch/crates/std_detect/src/detect/os/macos/aarch64.rs b/library/stdarch/crates/std_detect/src/detect/os/darwin/aarch64.rs index a29968b5c3d..3f292c1b1b1 100644 --- a/library/stdarch/crates/std_detect/src/detect/os/macos/aarch64.rs +++ b/library/stdarch/crates/std_detect/src/detect/os/darwin/aarch64.rs @@ -1,4 +1,6 @@ -//! Run-time feature detection for aarch64 on macOS. +//! Run-time feature detection for aarch64 on Darwin (macOS/iOS/tvOS/watchOS/visionOS). +//! +//! <https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics> use crate::detect::{cache, Feature}; |
