From 340bff7b8b36d858e4fc4fd228a573798a9104b2 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Fri, 23 Jan 2026 10:58:59 -0700 Subject: [PATCH] cpubits: better ARMv7 `cfg` predicate We can use the explicit: all(target_arch = "arm", target_feature = "v7") Rather than the previous check for targets that are not thumb: all(target_arch = "arm", not(target_feature = "thumb-mode")) --- cpubits/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpubits/src/lib.rs b/cpubits/src/lib.rs index 48242f5b..5c95f89e 100644 --- a/cpubits/src/lib.rs +++ b/cpubits/src/lib.rs @@ -100,7 +100,7 @@ /// certain targets from 32-bit to 64-bit ones. /// /// This 64-bit promotion occurs if `any` of the following `cfg`s are true: -/// - ARMv7: `all(target_arch = "arm", not(target_feature = "thumb-mode"))` +/// - ARMv7: `all(target_arch = "arm", target_feature = "v7")` /// - WASM: `target_arch = "wasm32"` #[macro_export] macro_rules! cpubits { @@ -184,7 +184,7 @@ macro_rules! cpubits { // `cfg` selector for 64-bit target overrides #[cfg(enable_64_bit = any( // ARMv7 - all(target_arch = "arm", not(target_feature = "thumb-mode")), + all(target_arch = "arm", target_feature = "v7"), // WASM target_arch = "wasm32", ))] @@ -321,7 +321,7 @@ mod tests { // Duplicated 64-bit override predicates need to go here if cfg!(any( // ARMv7 - all(target_arch = "arm", not(target_feature = "thumb-mode")), + all(target_arch = "arm", target_feature = "v7"), // WASM target_arch = "wasm32" )) { @@ -337,7 +337,7 @@ mod tests { } /// Explicit test for ARMv7 so we can see the predicate is working - #[cfg(all(target_arch = "arm", not(target_feature = "thumb-mode")))] + #[cfg(all(target_arch = "arm", target_feature = "v7"))] #[test] fn cpubits_on_armv7_is_64bit() { assert_eq!(CPUBITS, 64);