@@ -371,6 +371,7 @@ impl AtomicBool {
371
371
/// ```
372
372
#[ inline]
373
373
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
374
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
374
375
pub fn swap ( & self , val : bool , order : Ordering ) -> bool {
375
376
unsafe { atomic_swap ( self . v . get ( ) , val as u8 , order) != 0 }
376
377
}
@@ -401,6 +402,7 @@ impl AtomicBool {
401
402
/// ```
402
403
#[ inline]
403
404
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
405
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
404
406
pub fn compare_and_swap ( & self , current : bool , new : bool , order : Ordering ) -> bool {
405
407
match self . compare_exchange ( current, new, order, strongest_failure_ordering ( order) ) {
406
408
Ok ( x) => x,
@@ -446,6 +448,7 @@ impl AtomicBool {
446
448
/// ```
447
449
#[ inline]
448
450
#[ stable( feature = "extended_compare_and_swap" , since = "1.10.0" ) ]
451
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
449
452
pub fn compare_exchange ( & self ,
450
453
current : bool ,
451
454
new : bool ,
@@ -537,6 +540,7 @@ impl AtomicBool {
537
540
/// ```
538
541
#[ inline]
539
542
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
543
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
540
544
pub fn fetch_and ( & self , val : bool , order : Ordering ) -> bool {
541
545
unsafe { atomic_and ( self . v . get ( ) , val as u8 , order) != 0 }
542
546
}
@@ -568,6 +572,7 @@ impl AtomicBool {
568
572
/// ```
569
573
#[ inline]
570
574
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
575
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
571
576
pub fn fetch_nand ( & self , val : bool , order : Ordering ) -> bool {
572
577
// We can't use atomic_nand here because it can result in a bool with
573
578
// an invalid value. This happens because the atomic operation is done
@@ -610,6 +615,7 @@ impl AtomicBool {
610
615
/// ```
611
616
#[ inline]
612
617
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
618
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
613
619
pub fn fetch_or ( & self , val : bool , order : Ordering ) -> bool {
614
620
unsafe { atomic_or ( self . v . get ( ) , val as u8 , order) != 0 }
615
621
}
@@ -640,6 +646,7 @@ impl AtomicBool {
640
646
/// ```
641
647
#[ inline]
642
648
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
649
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
643
650
pub fn fetch_xor ( & self , val : bool , order : Ordering ) -> bool {
644
651
unsafe { atomic_xor ( self . v . get ( ) , val as u8 , order) != 0 }
645
652
}
@@ -786,6 +793,7 @@ impl<T> AtomicPtr<T> {
786
793
/// ```
787
794
#[ inline]
788
795
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
796
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
789
797
pub fn swap ( & self , ptr : * mut T , order : Ordering ) -> * mut T {
790
798
unsafe { atomic_swap ( self . p . get ( ) as * mut usize , ptr as usize , order) as * mut T }
791
799
}
@@ -815,6 +823,7 @@ impl<T> AtomicPtr<T> {
815
823
/// ```
816
824
#[ inline]
817
825
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
826
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
818
827
pub fn compare_and_swap ( & self , current : * mut T , new : * mut T , order : Ordering ) -> * mut T {
819
828
match self . compare_exchange ( current, new, order, strongest_failure_ordering ( order) ) {
820
829
Ok ( x) => x,
@@ -853,6 +862,7 @@ impl<T> AtomicPtr<T> {
853
862
/// ```
854
863
#[ inline]
855
864
#[ stable( feature = "extended_compare_and_swap" , since = "1.10.0" ) ]
865
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
856
866
pub fn compare_exchange ( & self ,
857
867
current : * mut T ,
858
868
new : * mut T ,
@@ -1138,6 +1148,7 @@ assert_eq!(some_var.swap(10, Ordering::Relaxed), 5);
1138
1148
```" ) ,
1139
1149
#[ inline]
1140
1150
#[ $stable]
1151
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
1141
1152
pub fn swap( & self , val: $int_type, order: Ordering ) -> $int_type {
1142
1153
unsafe { atomic_swap( self . v. get( ) , val, order) }
1143
1154
}
@@ -1170,6 +1181,7 @@ assert_eq!(some_var.load(Ordering::Relaxed), 10);
1170
1181
```" ) ,
1171
1182
#[ inline]
1172
1183
#[ $stable]
1184
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
1173
1185
pub fn compare_and_swap( & self ,
1174
1186
current: $int_type,
1175
1187
new: $int_type,
@@ -1223,6 +1235,7 @@ assert_eq!(some_var.load(Ordering::Relaxed), 10);
1223
1235
```" ) ,
1224
1236
#[ inline]
1225
1237
#[ $stable_cxchg]
1238
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
1226
1239
pub fn compare_exchange( & self ,
1227
1240
current: $int_type,
1228
1241
new: $int_type,
@@ -1677,6 +1690,7 @@ atomic_int!{
1677
1690
}
1678
1691
1679
1692
#[ inline]
1693
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
1680
1694
fn strongest_failure_ordering ( order : Ordering ) -> Ordering {
1681
1695
match order {
1682
1696
Release => Relaxed ,
@@ -1713,6 +1727,7 @@ unsafe fn atomic_load<T>(dst: *const T, order: Ordering) -> T {
1713
1727
}
1714
1728
1715
1729
#[ inline]
1730
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
1716
1731
unsafe fn atomic_swap < T > ( dst : * mut T , val : T , order : Ordering ) -> T {
1717
1732
match order {
1718
1733
Acquire => intrinsics:: atomic_xchg_acq ( dst, val) ,
@@ -1751,6 +1766,7 @@ unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T {
1751
1766
}
1752
1767
1753
1768
#[ inline]
1769
+ #[ cfg( any( stage0, target_has_atomic = "cas" ) ) ]
1754
1770
unsafe fn atomic_compare_exchange < T > ( dst : * mut T ,
1755
1771
old : T ,
1756
1772
new : T ,
0 commit comments