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> {
1040
1040
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1041
1041
#[ cfg( target_has_atomic = "ptr" ) ]
1042
1042
pub fn swap ( & self , ptr : * mut T , order : Ordering ) -> * mut T {
1043
+ #[ cfg( bootstrap) ]
1043
1044
// 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
+ }
1045
1053
}
1046
1054
1047
1055
/// 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