@@ -333,10 +333,10 @@ impl AtomicBool {
333333 #[ inline]
334334 #[ cfg( target_has_atomic_equal_alignment = "8" ) ]
335335 #[ 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 {
337337 // SAFETY: the mutable reference guarantees unique ownership, and
338338 // 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 ) }
340340 }
341341
342342 /// Consumes the atomic and returns the contained value.
@@ -934,14 +934,14 @@ impl<T> AtomicPtr<T> {
934934 #[ inline]
935935 #[ cfg( target_has_atomic_equal_alignment = "ptr" ) ]
936936 #[ 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 {
938938 use crate :: mem:: align_of;
939939 let [ ] = [ ( ) ; align_of :: < AtomicPtr < ( ) > > ( ) - align_of :: < * mut ( ) > ( ) ] ;
940940 // SAFETY:
941941 // - the mutable reference guarantees unique ownership.
942942 // - the alignment of `*mut T` and `Self` is the same on all platforms
943943 // 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 ) }
945945 }
946946
947947 /// Consumes the atomic and returns the contained value.
@@ -1447,14 +1447,14 @@ macro_rules! atomic_int {
14471447 #[ inline]
14481448 #[ $cfg_align]
14491449 #[ 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 {
14511451 use crate :: mem:: align_of;
14521452 let [ ] = [ ( ) ; align_of:: <Self >( ) - align_of:: <$int_type>( ) ] ;
14531453 // SAFETY:
14541454 // - the mutable reference guarantees unique ownership.
14551455 // - the alignment of `$int_type` and `Self` is the
14561456 // 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 ) }
14581458 }
14591459
14601460 /// Consumes the atomic and returns the contained value.
0 commit comments