File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1040,8 +1040,16 @@ impl<T> AtomicPtr<T> {
10401040 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
10411041 #[ cfg( target_has_atomic = "ptr" ) ]
10421042 pub fn swap ( & self , ptr : * mut T , order : Ordering ) -> * mut T {
1043+ #[ cfg( bootstrap) ]
10431044 // SAFETY: data races are prevented by atomic intrinsics.
1044- unsafe { atomic_swap ( self . p . get ( ) as * mut usize , ptr as usize , order) as * mut T }
1045+ unsafe {
1046+ atomic_swap ( self . p . get ( ) as * mut usize , ptr as usize , order) as * mut T
1047+ }
1048+ #[ cfg( not( bootstrap) ) ]
1049+ // SAFETY: data races are prevented by atomic intrinsics.
1050+ unsafe {
1051+ atomic_swap ( self . p . get ( ) , ptr, order)
1052+ }
10451053 }
10461054
10471055 /// Stores a value into the pointer if the current value is the same as the `current` value.
You can’t perform that action at this time.
0 commit comments