From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- library/core/src/sync/atomic.rs | 58 ++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 36 deletions(-) (limited to 'library/core/src/sync/atomic.rs') diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index 040a59184..f1ed68d72 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -960,6 +960,7 @@ impl AtomicBool { /// ```ignore (extern-declaration) /// # fn main() { /// use std::sync::atomic::AtomicBool; + /// /// extern "C" { /// fn my_atomic_op(arg: *mut bool); /// } @@ -971,7 +972,8 @@ impl AtomicBool { /// # } /// ``` #[inline] - #[unstable(feature = "atomic_mut_ptr", reason = "recently added", issue = "66893")] + #[stable(feature = "atomic_as_ptr", since = "1.70.0")] + #[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")] pub const fn as_ptr(&self) -> *mut bool { self.v.get().cast() } @@ -1890,7 +1892,6 @@ impl AtomicPtr { /// # Examples /// /// ```ignore (extern-declaration) - /// #![feature(atomic_mut_ptr)] /// use std::sync::atomic::AtomicPtr; /// /// extern "C" { @@ -1906,7 +1907,8 @@ impl AtomicPtr { /// } /// ``` #[inline] - #[unstable(feature = "atomic_mut_ptr", reason = "recently added", issue = "66893")] + #[stable(feature = "atomic_as_ptr", since = "1.70.0")] + #[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")] pub const fn as_ptr(&self) -> *mut *mut T { self.p.get() } @@ -1949,8 +1951,7 @@ macro_rules! if_not_8_bit { ($_:ident, $($tt:tt)*) => { $($tt)* }; } -#[cfg_attr(not(bootstrap), cfg(target_has_atomic_load_store))] -#[cfg_attr(bootstrap, cfg(target_has_atomic_load_store = "8"))] +#[cfg(target_has_atomic_load_store)] macro_rules! atomic_int { ($cfg_cas:meta, $cfg_align:meta, @@ -2859,9 +2860,8 @@ macro_rules! atomic_int { /// # } /// ``` #[inline] - #[unstable(feature = "atomic_mut_ptr", - reason = "recently added", - issue = "66893")] + #[stable(feature = "atomic_as_ptr", since = "1.70.0")] + #[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")] pub const fn as_ptr(&self) -> *mut $int_type { self.v.get() } @@ -3124,8 +3124,7 @@ atomic_int_ptr_sized! { } #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] fn strongest_failure_ordering(order: Ordering) -> Ordering { match order { Release => Relaxed, @@ -3167,8 +3166,7 @@ unsafe fn atomic_load(dst: *const T, order: Ordering) -> T { } #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_swap(dst: *mut T, val: T, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_swap`. @@ -3185,8 +3183,7 @@ unsafe fn atomic_swap(dst: *mut T, val: T, order: Ordering) -> T { /// Returns the previous value (like __sync_fetch_and_add). #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_add(dst: *mut T, val: T, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_add`. @@ -3203,8 +3200,7 @@ unsafe fn atomic_add(dst: *mut T, val: T, order: Ordering) -> T { /// Returns the previous value (like __sync_fetch_and_sub). #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_sub(dst: *mut T, val: T, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_sub`. @@ -3220,8 +3216,7 @@ unsafe fn atomic_sub(dst: *mut T, val: T, order: Ordering) -> T { } #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_compare_exchange( dst: *mut T, @@ -3256,8 +3251,7 @@ unsafe fn atomic_compare_exchange( } #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_compare_exchange_weak( dst: *mut T, @@ -3292,8 +3286,7 @@ unsafe fn atomic_compare_exchange_weak( } #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_and(dst: *mut T, val: T, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_and` @@ -3309,8 +3302,7 @@ unsafe fn atomic_and(dst: *mut T, val: T, order: Ordering) -> T { } #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_nand(dst: *mut T, val: T, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_nand` @@ -3326,8 +3318,7 @@ unsafe fn atomic_nand(dst: *mut T, val: T, order: Ordering) -> T { } #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_or(dst: *mut T, val: T, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_or` @@ -3343,8 +3334,7 @@ unsafe fn atomic_or(dst: *mut T, val: T, order: Ordering) -> T { } #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_xor(dst: *mut T, val: T, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_xor` @@ -3361,8 +3351,7 @@ unsafe fn atomic_xor(dst: *mut T, val: T, order: Ordering) -> T { /// returns the max value (signed comparison) #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_max(dst: *mut T, val: T, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_max` @@ -3379,8 +3368,7 @@ unsafe fn atomic_max(dst: *mut T, val: T, order: Ordering) -> T { /// returns the min value (signed comparison) #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_min(dst: *mut T, val: T, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_min` @@ -3397,8 +3385,7 @@ unsafe fn atomic_min(dst: *mut T, val: T, order: Ordering) -> T { /// returns the max value (unsigned comparison) #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_umax(dst: *mut T, val: T, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_umax` @@ -3415,8 +3402,7 @@ unsafe fn atomic_umax(dst: *mut T, val: T, order: Ordering) -> T { /// returns the min value (unsigned comparison) #[inline] -#[cfg_attr(not(bootstrap), cfg(target_has_atomic))] -#[cfg_attr(bootstrap, cfg(target_has_atomic = "8"))] +#[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces unsafe fn atomic_umin(dst: *mut T, val: T, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_umin` -- cgit v1.2.3