diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index 802d38e3994b3..02d1841bf4ae7 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -269,7 +269,7 @@ mod private { #[cfg(target_has_atomic_load_store = "64")] #[repr(C, align(8))] pub struct Align8(T); - #[cfg(target_has_atomic_load_store = "128")] + #[cfg(any(target_has_atomic_load_store = "128", doc))] #[repr(C, align(16))] pub struct Align16(T); } @@ -294,18 +294,42 @@ pub impl(self) unsafe trait AtomicPrimitive: Sized + Copy { type Storage: Sized; } -macro impl_atomic_primitive( - [$($T:ident)?] $Primitive:ty as $Storage:ident<$Operand:ty>, size($size:literal) -) { - #[unstable( - feature = "atomic_internals", - reason = "implementation detail which may disappear or be replaced at any time", - issue = "none" - )] - #[cfg(target_has_atomic_load_store = $size)] - unsafe impl $(<$T>)? AtomicPrimitive for $Primitive { - type Storage = private::$Storage<$Operand>; - } +macro impl_atomic_primitive { + ( + @impl [$($T:ident)?] $Primitive:ty as $Storage:ident<$Operand:ty>, + $cfg:meta + ) => { + #[unstable( + feature = "atomic_internals", + reason = "implementation detail which may disappear or be replaced at any time", + issue = "none" + )] + #[cfg($cfg)] + unsafe impl $(<$T>)? AtomicPrimitive for $Primitive { + type Storage = private::$Storage<$Operand>; + } + }, + + ( + [$($T:ident)?] $Primitive:ty as $Storage:ident<$Operand:ty>, + size($size:literal) + ) => { + impl_atomic_primitive!( + @impl [$($T)?] $Primitive as $Storage<$Operand>, + target_has_atomic_load_store = $size + ); + }, + + ( + [$($T:ident)?] $Primitive:ty as $Storage:ident<$Operand:ty>, + size($size:literal), + doc + ) => { + impl_atomic_primitive!( + @impl [$($T)?] $Primitive as $Storage<$Operand>, + any(target_has_atomic_load_store = $size, doc) + ); + }, } impl_atomic_primitive!([] bool as Align1, size("8")); @@ -317,8 +341,8 @@ impl_atomic_primitive!([] i32 as Align4, size("32")); impl_atomic_primitive!([] u32 as Align4, size("32")); impl_atomic_primitive!([] i64 as Align8, size("64")); impl_atomic_primitive!([] u64 as Align8, size("64")); -impl_atomic_primitive!([] i128 as Align16, size("128")); -impl_atomic_primitive!([] u128 as Align16, size("128")); +impl_atomic_primitive!([] i128 as Align16, size("128"), doc); +impl_atomic_primitive!([] u128 as Align16, size("128"), doc); #[cfg(target_pointer_width = "16")] impl_atomic_primitive!([] isize as Align2, size("ptr")); @@ -2529,7 +2553,8 @@ macro_rules! if_8_bit { #[cfg(target_has_atomic_load_store)] macro_rules! atomic_int { - ($cfg_cas:meta, + ($cfg_base:meta, + $cfg_cas:meta, $cfg_align:meta, $stable:meta, $stable_cxchg:meta, @@ -2605,7 +2630,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_base, doc = "```")] + #[cfg_attr(not($cfg_base), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::", stringify!($atomic_type), ";")] /// #[doc = concat!("let atomic_forty_two = ", stringify!($atomic_type), "::new(42);")] @@ -2624,7 +2650,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_base, doc = "```rust")] + #[cfg_attr(not($cfg_base), doc = "```rust,compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{self, ", stringify!($atomic_type), "};")] /// /// // Get a pointer to an allocated value @@ -2686,7 +2713,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_base, doc = "```")] + #[cfg_attr(not($cfg_base), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let mut some_var = ", stringify!($atomic_type), "::new(10);")] @@ -2714,7 +2742,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_align, doc = "```rust")] + #[cfg_attr(not($cfg_align), doc = "```rust,compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// /// let mut some_int = 123; @@ -2724,7 +2753,7 @@ macro_rules! atomic_int { /// ``` /// #[inline] - #[$cfg_align] + #[cfg(any($cfg_align, doc))] #[stable(feature = "atomic_from_mut", since = "CURRENT_RUSTC_VERSION")] pub fn from_mut(v: &mut $int_type) -> &mut Self { let [] = [(); align_of::() - align_of::<$int_type>()]; @@ -2742,7 +2771,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ```ignore-wasm + #[cfg_attr($cfg_base, doc = "```ignore-wasm")] + #[cfg_attr(not($cfg_base), doc = "```ignore-wasm,compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let mut some_ints = [const { ", stringify!($atomic_type), "::new(0) }; 10];")] @@ -2782,7 +2812,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ```ignore-wasm + #[cfg_attr($cfg_align, doc = "```ignore-wasm")] + #[cfg_attr(not($cfg_align), doc = "```ignore-wasm,compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// /// let mut some_ints = [0; 10]; @@ -2797,7 +2828,7 @@ macro_rules! atomic_int { /// } /// ``` #[inline] - #[$cfg_align] + #[cfg(any($cfg_align, doc))] #[stable(feature = "atomic_from_mut", since = "CURRENT_RUSTC_VERSION")] pub fn from_mut_slice(v: &mut [$int_type]) -> &mut [Self] { let [] = [(); align_of::() - align_of::<$int_type>()]; @@ -2815,7 +2846,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_base, doc = "```")] + #[cfg_attr(not($cfg_base), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::", stringify!($atomic_type), ";")] /// #[doc = concat!("let some_var = ", stringify!($atomic_type), "::new(5);")] @@ -2841,7 +2873,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_base, doc = "```")] + #[cfg_attr(not($cfg_base), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let some_var = ", stringify!($atomic_type), "::new(5);")] @@ -2867,7 +2900,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_base, doc = "```")] + #[cfg_attr(not($cfg_base), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let some_var = ", stringify!($atomic_type), "::new(5);")] @@ -2896,7 +2930,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let some_var = ", stringify!($atomic_type), "::new(5);")] @@ -2905,7 +2940,7 @@ macro_rules! atomic_int { /// ``` #[inline] #[$stable] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn swap(&self, val: $int_type, order: Ordering) -> $int_type { @@ -2953,7 +2988,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let some_var = ", stringify!($atomic_type), "::new(5);")] @@ -2970,7 +3006,7 @@ macro_rules! atomic_int { since = "1.50.0", note = "Use `compare_exchange` or `compare_exchange_weak` instead") ] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn compare_and_swap(&self, @@ -3006,7 +3042,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let some_var = ", stringify!($atomic_type), "::new(5);")] @@ -3039,7 +3076,7 @@ macro_rules! atomic_int { /// [compare-and-swap operation]: https://en.wikipedia.org/wiki/Compare-and-swap #[inline] #[$stable_cxchg] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn compare_exchange(&self, @@ -3073,7 +3110,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let val = ", stringify!($atomic_type), "::new(4);")] @@ -3103,7 +3141,7 @@ macro_rules! atomic_int { /// [compare-and-swap operation]: https://en.wikipedia.org/wiki/Compare-and-swap #[inline] #[$stable_cxchg] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn compare_exchange_weak(&self, @@ -3131,7 +3169,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let foo = ", stringify!($atomic_type), "::new(0);")] @@ -3140,7 +3179,7 @@ macro_rules! atomic_int { /// ``` #[inline] #[$stable] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn fetch_add(&self, val: $int_type, order: Ordering) -> $int_type { @@ -3162,7 +3201,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let foo = ", stringify!($atomic_type), "::new(20);")] @@ -3171,7 +3211,7 @@ macro_rules! atomic_int { /// ``` #[inline] #[$stable] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn fetch_sub(&self, val: $int_type, order: Ordering) -> $int_type { @@ -3196,7 +3236,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let foo = ", stringify!($atomic_type), "::new(0b101101);")] @@ -3205,7 +3246,7 @@ macro_rules! atomic_int { /// ``` #[inline] #[$stable] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn fetch_and(&self, val: $int_type, order: Ordering) -> $int_type { @@ -3230,7 +3271,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let foo = ", stringify!($atomic_type), "::new(0x13);")] @@ -3239,7 +3281,7 @@ macro_rules! atomic_int { /// ``` #[inline] #[$stable_nand] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn fetch_nand(&self, val: $int_type, order: Ordering) -> $int_type { @@ -3264,7 +3306,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let foo = ", stringify!($atomic_type), "::new(0b101101);")] @@ -3273,7 +3316,7 @@ macro_rules! atomic_int { /// ``` #[inline] #[$stable] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn fetch_or(&self, val: $int_type, order: Ordering) -> $int_type { @@ -3298,7 +3341,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let foo = ", stringify!($atomic_type), "::new(0b101101);")] @@ -3307,7 +3351,7 @@ macro_rules! atomic_int { /// ``` #[inline] #[$stable] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type { @@ -3320,7 +3364,7 @@ macro_rules! atomic_int { /// . #[inline] #[stable(feature = "no_more_cas", since = "1.45.0")] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] #[deprecated( @@ -3374,7 +3418,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ```rust + #[cfg_attr($cfg_cas, doc = "```rust")] + #[cfg_attr(not($cfg_cas), doc = "```rust,compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let x = ", stringify!($atomic_type), "::new(7);")] @@ -3385,7 +3430,7 @@ macro_rules! atomic_int { /// ``` #[inline] #[stable(feature = "atomic_try_update", since = "1.95.0")] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn try_update( @@ -3441,7 +3486,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ```rust + #[cfg_attr($cfg_cas, doc = "```rust")] + #[cfg_attr(not($cfg_cas), doc = "```rust,compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let x = ", stringify!($atomic_type), "::new(7);")] @@ -3451,7 +3497,7 @@ macro_rules! atomic_int { /// ``` #[inline] #[stable(feature = "atomic_try_update", since = "1.95.0")] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn update( @@ -3486,7 +3532,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let foo = ", stringify!($atomic_type), "::new(23);")] @@ -3496,7 +3543,8 @@ macro_rules! atomic_int { /// /// If you want to obtain the maximum value in one step, you can use the following: /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let foo = ", stringify!($atomic_type), "::new(23);")] @@ -3506,7 +3554,7 @@ macro_rules! atomic_int { /// ``` #[inline] #[stable(feature = "atomic_min_max", since = "1.45.0")] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn fetch_max(&self, val: $int_type, order: Ordering) -> $int_type { @@ -3531,7 +3579,8 @@ macro_rules! atomic_int { /// /// # Examples /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let foo = ", stringify!($atomic_type), "::new(23);")] @@ -3543,7 +3592,8 @@ macro_rules! atomic_int { /// /// If you want to obtain the minimum value in one step, you can use the following: /// - /// ``` + #[cfg_attr($cfg_cas, doc = "```")] + #[cfg_attr(not($cfg_cas), doc = "```compile_fail")] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let foo = ", stringify!($atomic_type), "::new(23);")] @@ -3553,7 +3603,7 @@ macro_rules! atomic_int { /// ``` #[inline] #[stable(feature = "atomic_min_max", since = "1.45.0")] - #[$cfg_cas] + #[cfg(any($cfg_cas, doc))] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[rustc_should_not_be_called_on_const_items] pub fn fetch_min(&self, val: $int_type, order: Ordering) -> $int_type { @@ -3606,8 +3656,9 @@ macro_rules! atomic_int { #[cfg(target_has_atomic_load_store = "8")] atomic_int! { - cfg(target_has_atomic = "8"), - cfg(target_has_atomic_primitive_alignment = "8"), + target_has_atomic_load_store = "8", + target_has_atomic = "8", + target_has_atomic_primitive_alignment = "8", stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), @@ -3624,8 +3675,9 @@ atomic_int! { } #[cfg(target_has_atomic_load_store = "8")] atomic_int! { - cfg(target_has_atomic = "8"), - cfg(target_has_atomic_primitive_alignment = "8"), + target_has_atomic_load_store = "8", + target_has_atomic = "8", + target_has_atomic_primitive_alignment = "8", stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), @@ -3642,8 +3694,9 @@ atomic_int! { } #[cfg(target_has_atomic_load_store = "16")] atomic_int! { - cfg(target_has_atomic = "16"), - cfg(target_has_atomic_primitive_alignment = "16"), + target_has_atomic_load_store = "16", + target_has_atomic = "16", + target_has_atomic_primitive_alignment = "16", stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), @@ -3660,8 +3713,9 @@ atomic_int! { } #[cfg(target_has_atomic_load_store = "16")] atomic_int! { - cfg(target_has_atomic = "16"), - cfg(target_has_atomic_primitive_alignment = "16"), + target_has_atomic_load_store = "16", + target_has_atomic = "16", + target_has_atomic_primitive_alignment = "16", stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), @@ -3678,8 +3732,9 @@ atomic_int! { } #[cfg(target_has_atomic_load_store = "32")] atomic_int! { - cfg(target_has_atomic = "32"), - cfg(target_has_atomic_primitive_alignment = "32"), + target_has_atomic_load_store = "32", + target_has_atomic = "32", + target_has_atomic_primitive_alignment = "32", stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), @@ -3696,8 +3751,9 @@ atomic_int! { } #[cfg(target_has_atomic_load_store = "32")] atomic_int! { - cfg(target_has_atomic = "32"), - cfg(target_has_atomic_primitive_alignment = "32"), + target_has_atomic_load_store = "32", + target_has_atomic = "32", + target_has_atomic_primitive_alignment = "32", stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), @@ -3714,8 +3770,9 @@ atomic_int! { } #[cfg(target_has_atomic_load_store = "64")] atomic_int! { - cfg(target_has_atomic = "64"), - cfg(target_has_atomic_primitive_alignment = "64"), + target_has_atomic_load_store = "64", + target_has_atomic = "64", + target_has_atomic_primitive_alignment = "64", stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), @@ -3732,8 +3789,9 @@ atomic_int! { } #[cfg(target_has_atomic_load_store = "64")] atomic_int! { - cfg(target_has_atomic = "64"), - cfg(target_has_atomic_primitive_alignment = "64"), + target_has_atomic_load_store = "64", + target_has_atomic = "64", + target_has_atomic_primitive_alignment = "64", stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), stable(feature = "integer_atomics_stable", since = "1.34.0"), @@ -3748,10 +3806,11 @@ atomic_int! { 8, u64 AtomicU64 } -#[cfg(target_has_atomic_load_store = "128")] +#[cfg(any(target_has_atomic_load_store = "128", doc))] atomic_int! { - cfg(target_has_atomic = "128"), - cfg(target_has_atomic_primitive_alignment = "128"), + target_has_atomic_load_store = "128", + target_has_atomic = "128", + target_has_atomic_primitive_alignment = "128", unstable(feature = "integer_atomics", issue = "99069"), unstable(feature = "integer_atomics", issue = "99069"), unstable(feature = "integer_atomics", issue = "99069"), @@ -3766,10 +3825,11 @@ atomic_int! { 16, i128 AtomicI128 } -#[cfg(target_has_atomic_load_store = "128")] +#[cfg(any(target_has_atomic_load_store = "128", doc))] atomic_int! { - cfg(target_has_atomic = "128"), - cfg(target_has_atomic_primitive_alignment = "128"), + target_has_atomic_load_store = "128", + target_has_atomic = "128", + target_has_atomic_primitive_alignment = "128", unstable(feature = "integer_atomics", issue = "99069"), unstable(feature = "integer_atomics", issue = "99069"), unstable(feature = "integer_atomics", issue = "99069"), @@ -3790,8 +3850,9 @@ macro_rules! atomic_int_ptr_sized { ( $($target_pointer_width:literal $align:literal)* ) => { $( #[cfg(target_pointer_width = $target_pointer_width)] atomic_int! { - cfg(target_has_atomic = "ptr"), - cfg(target_has_atomic_primitive_alignment = "ptr"), + target_has_atomic_load_store = "ptr", + target_has_atomic = "ptr", + target_has_atomic_primitive_alignment = "ptr", stable(feature = "rust1", since = "1.0.0"), stable(feature = "extended_compare_and_swap", since = "1.10.0"), stable(feature = "atomic_debug", since = "1.3.0"), @@ -3808,8 +3869,9 @@ macro_rules! atomic_int_ptr_sized { } #[cfg(target_pointer_width = $target_pointer_width)] atomic_int! { - cfg(target_has_atomic = "ptr"), - cfg(target_has_atomic_primitive_alignment = "ptr"), + target_has_atomic_load_store = "ptr", + target_has_atomic = "ptr", + target_has_atomic_primitive_alignment = "ptr", stable(feature = "rust1", since = "1.0.0"), stable(feature = "extended_compare_and_swap", since = "1.10.0"), stable(feature = "atomic_debug", since = "1.3.0"),