@@ -497,33 +497,25 @@ macro_rules! impl_arithmetic {
497
497
} ;
498
498
}
499
499
500
- #[ cfg( has_atomic_u8) ]
501
500
impl_arithmetic ! ( u8 , atomic:: AtomicU8 , "let a = AtomicCell::new(7u8);" ) ;
502
- #[ cfg( all( has_atomic_u8, not( crossbeam_loom) ) ) ]
503
501
impl_arithmetic ! ( i8 , atomic:: AtomicI8 , "let a = AtomicCell::new(7i8);" ) ;
504
- #[ cfg( has_atomic_u16) ]
505
502
impl_arithmetic ! ( u16 , atomic:: AtomicU16 , "let a = AtomicCell::new(7u16);" ) ;
506
- #[ cfg( all( has_atomic_u16, not( crossbeam_loom) ) ) ]
507
503
impl_arithmetic ! ( i16 , atomic:: AtomicI16 , "let a = AtomicCell::new(7i16);" ) ;
508
- #[ cfg( has_atomic_u32) ]
509
504
impl_arithmetic ! ( u32 , atomic:: AtomicU32 , "let a = AtomicCell::new(7u32);" ) ;
510
- #[ cfg( all( has_atomic_u32, not( crossbeam_loom) ) ) ]
511
505
impl_arithmetic ! ( i32 , atomic:: AtomicI32 , "let a = AtomicCell::new(7i32);" ) ;
512
- #[ cfg( has_atomic_u64 ) ]
506
+ #[ cfg( not ( crossbeam_no_atomic_64 ) ) ]
513
507
impl_arithmetic ! ( u64 , atomic:: AtomicU64 , "let a = AtomicCell::new(7u64);" ) ;
514
- #[ cfg( all ( has_atomic_u64 , not( crossbeam_loom ) ) ) ]
508
+ #[ cfg( not( crossbeam_no_atomic_64 ) ) ]
515
509
impl_arithmetic ! ( i64 , atomic:: AtomicI64 , "let a = AtomicCell::new(7i64);" ) ;
516
- #[ cfg( all( has_atomic_u128, not( crossbeam_loom) ) ) ]
517
- impl_arithmetic ! ( u128 , atomic:: AtomicU128 , "let a = AtomicCell::new(7u128);" ) ;
518
- #[ cfg( all( has_atomic_u128, not( crossbeam_loom) ) ) ]
519
- impl_arithmetic ! ( i128 , atomic:: AtomicI128 , "let a = AtomicCell::new(7i128);" ) ;
510
+ // TODO: AtomicU128 is unstable
511
+ // impl_arithmetic!(u128, atomic::AtomicU128, "let a = AtomicCell::new(7u128);");
512
+ // impl_arithmetic!(i128, atomic::AtomicI128, "let a = AtomicCell::new(7i128);");
520
513
521
514
impl_arithmetic ! (
522
515
usize ,
523
516
atomic:: AtomicUsize ,
524
517
"let a = AtomicCell::new(7usize);"
525
518
) ;
526
- #[ cfg( not( crossbeam_loom) ) ]
527
519
impl_arithmetic ! (
528
520
isize ,
529
521
atomic:: AtomicIsize ,
@@ -809,16 +801,13 @@ macro_rules! atomic {
809
801
atomic!( @check, $t, AtomicUnit , $a, $atomic_op) ;
810
802
atomic!( @check, $t, atomic:: AtomicUsize , $a, $atomic_op) ;
811
803
812
- #[ cfg( has_atomic_u8) ]
813
804
atomic!( @check, $t, atomic:: AtomicU8 , $a, $atomic_op) ;
814
- #[ cfg( has_atomic_u16) ]
815
805
atomic!( @check, $t, atomic:: AtomicU16 , $a, $atomic_op) ;
816
- #[ cfg( has_atomic_u32) ]
817
806
atomic!( @check, $t, atomic:: AtomicU32 , $a, $atomic_op) ;
818
- #[ cfg( has_atomic_u64 ) ]
807
+ #[ cfg( not ( crossbeam_no_atomic_64 ) ) ]
819
808
atomic!( @check, $t, atomic:: AtomicU64 , $a, $atomic_op) ;
820
- # [ cfg ( has_atomic_u128 ) ]
821
- atomic!( @check, $t, atomic:: AtomicU128 , $a, $atomic_op) ;
809
+ // TODO: AtomicU128 is unstable
810
+ // atomic!(@check, $t, atomic::AtomicU128, $a, $atomic_op);
822
811
823
812
#[ cfg( crossbeam_loom) ]
824
813
unimplemented!( "loom does not support non-atomic atomic ops" ) ;
@@ -831,17 +820,15 @@ macro_rules! atomic {
831
820
/// Returns `true` if operations on `AtomicCell<T>` are lock-free.
832
821
const fn atomic_is_lock_free < T > ( ) -> bool {
833
822
// HACK(taiki-e): This is equivalent to `atomic! { T, _a, true, false }`, but can be used in const fn even in Rust 1.36.
834
- let is_lock_free = can_transmute :: < T , AtomicUnit > ( ) | can_transmute :: < T , atomic:: AtomicUsize > ( ) ;
835
- #[ cfg( has_atomic_u8) ]
836
- let is_lock_free = is_lock_free | can_transmute :: < T , atomic:: AtomicU8 > ( ) ;
837
- #[ cfg( has_atomic_u16) ]
838
- let is_lock_free = is_lock_free | can_transmute :: < T , atomic:: AtomicU16 > ( ) ;
839
- #[ cfg( has_atomic_u32) ]
840
- let is_lock_free = is_lock_free | can_transmute :: < T , atomic:: AtomicU32 > ( ) ;
841
- #[ cfg( has_atomic_u64) ]
823
+ let is_lock_free = can_transmute :: < T , AtomicUnit > ( )
824
+ | can_transmute :: < T , atomic:: AtomicUsize > ( )
825
+ | can_transmute :: < T , atomic:: AtomicU8 > ( )
826
+ | can_transmute :: < T , atomic:: AtomicU16 > ( )
827
+ | can_transmute :: < T , atomic:: AtomicU32 > ( ) ;
828
+ #[ cfg( not( crossbeam_no_atomic_64) ) ]
842
829
let is_lock_free = is_lock_free | can_transmute :: < T , atomic:: AtomicU64 > ( ) ;
843
- # [ cfg ( has_atomic_u128 ) ]
844
- let is_lock_free = is_lock_free | can_transmute :: < T , atomic:: AtomicU128 > ( ) ;
830
+ // TODO: AtomicU128 is unstable
831
+ // let is_lock_free = is_lock_free | can_transmute::<T, atomic::AtomicU128>();
845
832
is_lock_free
846
833
}
847
834
0 commit comments