rustc_data_structures: Explicitly check for 64-bit atomics support · rust-lang/rust@ab1b48e (original) (raw)

File tree

3 files changed

lines changed

3 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ libc = "0.2"
50 50 memmap2 = "0.2.1"
51 51 # tidy-alphabetical-end
52 52
53 -[target.'cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "sparc"))'.dependencies]
53 +[target.'cfg(not(target_has_atomic = "64"))'.dependencies]
54 54 portable-atomic = "1.5.1"
55 55
56 56 [features]
Original file line number Diff line number Diff line change
@@ -147,14 +147,13 @@ cfg_match! {
147 147 [crate::owned_slice::OwnedSlice]
148 148 );
149 149
150 -// MIPS, PowerPC and SPARC platforms with 32-bit pointers do not
151 -// have AtomicU64 type.
152 - #[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc", target_arch = "sparc")))]
150 +// Use portable AtomicU64 for targets without native 64-bit atomics
151 + #[cfg(target_has_atomic = "64")]
153 152 already_sync!(
154 153 [std::sync::atomic::AtomicU64]
155 154 );
156 155
157 - #[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "sparc"))]
156 + #[cfg(not(target_has_atomic = "64"))]
158 157 already_sync!(
159 158 [portable_atomic::AtomicU64]
160 159 );
Original file line number Diff line number Diff line change
@@ -270,12 +270,11 @@ cfg_match! {
270 270
271 271 pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32};
272 272
273 -// MIPS, PowerPC and SPARC platforms with 32-bit pointers do not
274 -// have AtomicU64 type.
275 - #[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "sparc")))]
273 +// Use portable AtomicU64 for targets without native 64-bit atomics
274 + #[cfg(target_has_atomic = "64")]
276 275 pub use std::sync::atomic::AtomicU64;
277 276
278 - #[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "sparc"))]
277 + #[cfg(not(target_has_atomic = "64"))]
279 278 pub use portable_atomic::AtomicU64;
280 279
281 280 pub use std::sync::Arc as Lrc;