@@ -497,33 +497,25 @@ macro_rules! impl_arithmetic {
497497 };
498498}
499499
500- #[cfg(has_atomic_u8)]
501500impl_arithmetic!(u8, atomic::AtomicU8, "let a = AtomicCell::new(7u8);");
502- #[cfg(all(has_atomic_u8, not(crossbeam_loom)))]
503501impl_arithmetic!(i8, atomic::AtomicI8, "let a = AtomicCell::new(7i8);");
504- #[cfg(has_atomic_u16)]
505502impl_arithmetic!(u16, atomic::AtomicU16, "let a = AtomicCell::new(7u16);");
506- #[cfg(all(has_atomic_u16, not(crossbeam_loom)))]
507503impl_arithmetic!(i16, atomic::AtomicI16, "let a = AtomicCell::new(7i16);");
508- #[cfg(has_atomic_u32)]
509504impl_arithmetic!(u32, atomic::AtomicU32, "let a = AtomicCell::new(7u32);");
510- #[cfg(all(has_atomic_u32, not(crossbeam_loom)))]
511505impl_arithmetic!(i32, atomic::AtomicI32, "let a = AtomicCell::new(7i32);");
512- #[cfg(has_atomic_u64 )]
506+ #[cfg(not(crossbeam_no_atomic_64) )]
513507impl_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 ))]
515509impl_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);");
520513
521514impl_arithmetic!(
522515 usize,
523516 atomic::AtomicUsize,
524517 "let a = AtomicCell::new(7usize);"
525518);
526- #[cfg(not(crossbeam_loom))]
527519impl_arithmetic!(
528520 isize,
529521 atomic::AtomicIsize,
@@ -809,16 +801,13 @@ macro_rules! atomic {
809801 atomic!(@check, $t, AtomicUnit, $a, $atomic_op);
810802 atomic!(@check, $t, atomic::AtomicUsize, $a, $atomic_op);
811803
812- #[cfg(has_atomic_u8)]
813804 atomic!(@check, $t, atomic::AtomicU8, $a, $atomic_op);
814- #[cfg(has_atomic_u16)]
815805 atomic!(@check, $t, atomic::AtomicU16, $a, $atomic_op);
816- #[cfg(has_atomic_u32)]
817806 atomic!(@check, $t, atomic::AtomicU32, $a, $atomic_op);
818- #[cfg(has_atomic_u64 )]
807+ #[cfg(not(crossbeam_no_atomic_64) )]
819808 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);
822811
823812 #[cfg(crossbeam_loom)]
824813 unimplemented!("loom does not support non-atomic atomic ops");
@@ -831,17 +820,15 @@ macro_rules! atomic {
831820/// Returns `true` if operations on `AtomicCell<T>` are lock-free.
832821const fn atomic_is_lock_free<T>() -> bool {
833822 // 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))]
842829 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>();
845832 is_lock_free
846833}
847834
0 commit comments