diff options
Diffstat (limited to 'tests/atomic_cell.rs')
-rw-r--r-- | tests/atomic_cell.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/atomic_cell.rs b/tests/atomic_cell.rs index edb7a4b..9fe6932 100644 --- a/tests/atomic_cell.rs +++ b/tests/atomic_cell.rs @@ -6,11 +6,11 @@ use crossbeam_utils::atomic::AtomicCell; #[test] fn is_lock_free() { - struct UsizeWrap(usize); - struct U8Wrap(bool); - struct I16Wrap(i16); + struct UsizeWrap(#[allow(dead_code)] usize); + struct U8Wrap(#[allow(dead_code)] bool); + struct I16Wrap(#[allow(dead_code)] i16); #[repr(align(8))] - struct U64Align8(u64); + struct U64Align8(#[allow(dead_code)] u64); assert!(AtomicCell::<usize>::is_lock_free()); assert!(AtomicCell::<isize>::is_lock_free()); @@ -35,13 +35,13 @@ fn is_lock_free() { // of `AtomicU64` is `8`, so `AtomicCell<u64>` is not lock-free. assert_eq!( AtomicCell::<u64>::is_lock_free(), - cfg!(not(crossbeam_no_atomic_64)) && std::mem::align_of::<u64>() == 8 + cfg!(target_has_atomic = "64") && std::mem::align_of::<u64>() == 8 ); assert_eq!(mem::size_of::<U64Align8>(), 8); assert_eq!(mem::align_of::<U64Align8>(), 8); assert_eq!( AtomicCell::<U64Align8>::is_lock_free(), - cfg!(not(crossbeam_no_atomic_64)) + cfg!(target_has_atomic = "64") ); // AtomicU128 is unstable @@ -307,7 +307,6 @@ test_arithmetic!(arithmetic_i128, i128); // https://github.com/crossbeam-rs/crossbeam/issues/748 #[cfg_attr(miri, ignore)] // TODO -#[rustversion::since(1.37)] // #[repr(align(N))] requires Rust 1.37 #[test] fn issue_748() { #[allow(dead_code)] @@ -321,14 +320,13 @@ fn issue_748() { assert_eq!(mem::size_of::<Test>(), 8); assert_eq!( AtomicCell::<Test>::is_lock_free(), - cfg!(not(crossbeam_no_atomic_64)) + cfg!(target_has_atomic = "64") ); let x = AtomicCell::new(Test::FieldLess); assert_eq!(x.load(), Test::FieldLess); } // https://github.com/crossbeam-rs/crossbeam/issues/833 -#[rustversion::since(1.40)] // const_constructor requires Rust 1.40 #[test] fn issue_833() { use std::num::NonZeroU128; |