@@ -110,7 +110,6 @@ use self::Ordering::*;
110
110
use crate :: cell:: UnsafeCell ;
111
111
use crate :: fmt;
112
112
use crate :: intrinsics;
113
- use crate :: mem:: align_of;
114
113
115
114
use crate :: hint:: spin_loop;
116
115
@@ -328,27 +327,6 @@ impl AtomicBool {
328
327
unsafe { & mut * ( self . v . get ( ) as * mut bool ) }
329
328
}
330
329
331
- /// Get atomic access to a `&mut bool`.
332
- ///
333
- /// # Examples
334
- ///
335
- /// ```
336
- /// #![feature(atomic_from_mut)]
337
- /// use std::sync::atomic::{AtomicBool, Ordering};
338
- ///
339
- /// let mut some_bool = true;
340
- /// let a = AtomicBool::from_mut(&mut some_bool);
341
- /// a.store(false, Ordering::Relaxed);
342
- /// assert_eq!(some_bool, false);
343
- /// ```
344
- #[ inline]
345
- #[ unstable( feature = "atomic_from_mut" , issue = "76314" ) ]
346
- pub fn from_mut ( v : & mut bool ) -> & Self {
347
- // SAFETY: the mutable reference guarantees unique ownership, and
348
- // alignment of both `bool` and `Self` is 1.
349
- unsafe { & * ( v as * mut bool as * mut Self ) }
350
- }
351
-
352
330
/// Consumes the atomic and returns the contained value.
353
331
///
354
332
/// This is safe because passing `self` by value guarantees that no other threads are
@@ -842,30 +820,6 @@ impl<T> AtomicPtr<T> {
842
820
unsafe { & mut * self . p . get ( ) }
843
821
}
844
822
845
- /// Get atomic access to a pointer.
846
- ///
847
- /// # Examples
848
- ///
849
- /// ```
850
- /// #![feature(atomic_from_mut)]
851
- /// use std::sync::atomic::{AtomicPtr, Ordering};
852
- ///
853
- /// let mut some_ptr = &mut 123 as *mut i32;
854
- /// let a = AtomicPtr::from_mut(&mut some_ptr);
855
- /// a.store(&mut 456, Ordering::Relaxed);
856
- /// assert_eq!(unsafe { *some_ptr }, 456);
857
- /// ```
858
- #[ inline]
859
- #[ unstable( feature = "atomic_from_mut" , issue = "76314" ) ]
860
- pub fn from_mut ( v : & mut * mut T ) -> & Self {
861
- let [ ] = [ ( ) ; align_of :: < AtomicPtr < ( ) > > ( ) - align_of :: < * mut ( ) > ( ) ] ;
862
- // SAFETY:
863
- // - the mutable reference guarantees unique ownership.
864
- // - the alignment of `*mut T` and `Self` is the same on all platforms
865
- // supported by rust, as verified above.
866
- unsafe { & * ( v as * mut * mut T as * mut Self ) }
867
- }
868
-
869
823
/// Consumes the atomic and returns the contained value.
870
824
///
871
825
/// This is safe because passing `self` by value guarantees that no other threads are
@@ -1168,7 +1122,6 @@ macro_rules! atomic_int {
1168
1122
$stable_nand: meta,
1169
1123
$const_stable: meta,
1170
1124
$stable_init_const: meta,
1171
- $( from_mut: cfg( $from_mut_cfg: meta) , ) ?
1172
1125
$s_int_type: literal, $int_ref: expr,
1173
1126
$extra_feature: expr,
1174
1127
$min_fn: ident, $max_fn: ident,
@@ -1280,45 +1233,6 @@ assert_eq!(some_var.load(Ordering::SeqCst), 5);
1280
1233
}
1281
1234
}
1282
1235
1283
- doc_comment! {
1284
- concat!( "Get atomic access to a `&mut " , stringify!( $int_type) , "`.
1285
-
1286
- " ,
1287
- if_not_8_bit! {
1288
- $int_type,
1289
- concat!(
1290
- "**Note:** This function is only available on targets where `" ,
1291
- stringify!( $int_type) , "` has an alignment of " , $align, " bytes."
1292
- )
1293
- } ,
1294
- "
1295
-
1296
- # Examples
1297
-
1298
- ```
1299
- #![feature(atomic_from_mut)]
1300
- " , $extra_feature, "use std::sync::atomic::{" , stringify!( $atomic_type) , ", Ordering};
1301
-
1302
- let mut some_int = 123;
1303
- let a = " , stringify!( $atomic_type) , "::from_mut(&mut some_int);
1304
- a.store(100, Ordering::Relaxed);
1305
- assert_eq!(some_int, 100);
1306
- ```
1307
- " ) ,
1308
- #[ inline]
1309
- $( #[ cfg( $from_mut_cfg) ] ) ?
1310
- #[ unstable( feature = "atomic_from_mut" , issue = "76314" ) ]
1311
- pub fn from_mut( v: & mut $int_type) -> & Self {
1312
- let [ ] = [ ( ) ; align_of:: <Self >( ) - align_of:: <$int_type>( ) ] ;
1313
- // SAFETY:
1314
- // - the mutable reference guarantees unique ownership.
1315
- // - the alignment of `$int_type` and `Self` is the
1316
- // same on all platforms enabled by `$from_mut_cfg`
1317
- // as verified above.
1318
- unsafe { & * ( v as * mut $int_type as * mut Self ) }
1319
- }
1320
- }
1321
-
1322
1236
doc_comment! {
1323
1237
concat!( "Consumes the atomic and returns the contained value.
1324
1238
@@ -2077,7 +1991,6 @@ atomic_int! {
2077
1991
stable( feature = "integer_atomics_stable" , since = "1.34.0" ) ,
2078
1992
rustc_const_stable( feature = "const_integer_atomics" , since = "1.34.0" ) ,
2079
1993
unstable( feature = "integer_atomics" , issue = "32976" ) ,
2080
- from_mut: cfg( not( target_arch = "x86" ) ) ,
2081
1994
"i64" , "../../../std/primitive.i64.html" ,
2082
1995
"" ,
2083
1996
atomic_min, atomic_max,
@@ -2096,7 +2009,6 @@ atomic_int! {
2096
2009
stable( feature = "integer_atomics_stable" , since = "1.34.0" ) ,
2097
2010
rustc_const_stable( feature = "const_integer_atomics" , since = "1.34.0" ) ,
2098
2011
unstable( feature = "integer_atomics" , issue = "32976" ) ,
2099
- from_mut: cfg( not( target_arch = "x86" ) ) ,
2100
2012
"u64" , "../../../std/primitive.u64.html" ,
2101
2013
"" ,
2102
2014
atomic_umin, atomic_umax,
@@ -2115,7 +2027,6 @@ atomic_int! {
2115
2027
unstable( feature = "integer_atomics" , issue = "32976" ) ,
2116
2028
rustc_const_stable( feature = "const_integer_atomics" , since = "1.34.0" ) ,
2117
2029
unstable( feature = "integer_atomics" , issue = "32976" ) ,
2118
- from_mut: cfg( not( target_arch = "x86_64" ) ) ,
2119
2030
"i128" , "../../../std/primitive.i128.html" ,
2120
2031
"#![feature(integer_atomics)]\n \n " ,
2121
2032
atomic_min, atomic_max,
@@ -2134,7 +2045,6 @@ atomic_int! {
2134
2045
unstable( feature = "integer_atomics" , issue = "32976" ) ,
2135
2046
rustc_const_stable( feature = "const_integer_atomics" , since = "1.34.0" ) ,
2136
2047
unstable( feature = "integer_atomics" , issue = "32976" ) ,
2137
- from_mut: cfg( not( target_arch = "x86_64" ) ) ,
2138
2048
"u128" , "../../../std/primitive.u128.html" ,
2139
2049
"#![feature(integer_atomics)]\n \n " ,
2140
2050
atomic_umin, atomic_umax,
0 commit comments