@@ -333,10 +333,10 @@ impl AtomicBool {
333
333
#[ inline]
334
334
#[ cfg( target_has_atomic_equal_alignment = "8" ) ]
335
335
#[ unstable( feature = "atomic_from_mut" , issue = "76314" ) ]
336
- pub fn from_mut ( v : & mut bool ) -> & Self {
336
+ pub fn from_mut ( v : & mut bool ) -> & mut Self {
337
337
// SAFETY: the mutable reference guarantees unique ownership, and
338
338
// alignment of both `bool` and `Self` is 1.
339
- unsafe { & * ( v as * mut bool as * mut Self ) }
339
+ unsafe { & mut * ( v as * mut bool as * mut Self ) }
340
340
}
341
341
342
342
/// Consumes the atomic and returns the contained value.
@@ -934,14 +934,14 @@ impl<T> AtomicPtr<T> {
934
934
#[ inline]
935
935
#[ cfg( target_has_atomic_equal_alignment = "ptr" ) ]
936
936
#[ unstable( feature = "atomic_from_mut" , issue = "76314" ) ]
937
- pub fn from_mut ( v : & mut * mut T ) -> & Self {
937
+ pub fn from_mut ( v : & mut * mut T ) -> & mut Self {
938
938
use crate :: mem:: align_of;
939
939
let [ ] = [ ( ) ; align_of :: < AtomicPtr < ( ) > > ( ) - align_of :: < * mut ( ) > ( ) ] ;
940
940
// SAFETY:
941
941
// - the mutable reference guarantees unique ownership.
942
942
// - the alignment of `*mut T` and `Self` is the same on all platforms
943
943
// supported by rust, as verified above.
944
- unsafe { & * ( v as * mut * mut T as * mut Self ) }
944
+ unsafe { & mut * ( v as * mut * mut T as * mut Self ) }
945
945
}
946
946
947
947
/// Consumes the atomic and returns the contained value.
@@ -1447,14 +1447,14 @@ macro_rules! atomic_int {
1447
1447
#[ inline]
1448
1448
#[ $cfg_align]
1449
1449
#[ unstable( feature = "atomic_from_mut" , issue = "76314" ) ]
1450
- pub fn from_mut( v: & mut $int_type) -> & Self {
1450
+ pub fn from_mut( v: & mut $int_type) -> & mut Self {
1451
1451
use crate :: mem:: align_of;
1452
1452
let [ ] = [ ( ) ; align_of:: <Self >( ) - align_of:: <$int_type>( ) ] ;
1453
1453
// SAFETY:
1454
1454
// - the mutable reference guarantees unique ownership.
1455
1455
// - the alignment of `$int_type` and `Self` is the
1456
1456
// same, as promised by $cfg_align and verified above.
1457
- unsafe { & * ( v as * mut $int_type as * mut Self ) }
1457
+ unsafe { & mut * ( v as * mut $int_type as * mut Self ) }
1458
1458
}
1459
1459
1460
1460
/// Consumes the atomic and returns the contained value.
0 commit comments