diff --git a/crossbeam-utils/Cargo.toml b/crossbeam-utils/Cargo.toml index 424fe542f..16488cb52 100644 --- a/crossbeam-utils/Cargo.toml +++ b/crossbeam-utils/Cargo.toml @@ -34,7 +34,6 @@ nightly = [] [dependencies] cfg-if = "1" lazy_static = { version = "1.4.0", optional = true } -array-macro = "2.1.0" # Enable the use of loom for concurrency testing. # diff --git a/crossbeam-utils/src/atomic/atomic_cell.rs b/crossbeam-utils/src/atomic/atomic_cell.rs index 7c405c3ac..84de9dfb6 100644 --- a/crossbeam-utils/src/atomic/atomic_cell.rs +++ b/crossbeam-utils/src/atomic/atomic_cell.rs @@ -3,7 +3,6 @@ #![allow(clippy::let_unit_value)] use crate::primitive::sync::atomic::{self, AtomicBool}; -use array_macro::array; use core::cell::UnsafeCell; use core::fmt; use core::mem; @@ -684,8 +683,13 @@ fn lock(addr: usize) -> &'static SeqLock { // stored at addresses that are multiples of 3. It'd be too bad if `LEN` was divisible by 3. // In order to protect from such cases, we simply choose a large prime number for `LEN`. const LEN: usize = 97; - - static LOCKS: [SeqLock; LEN] = array![_ => SeqLock::new(); LEN]; + const L: SeqLock = SeqLock::new(); + static LOCKS: [SeqLock; LEN] = [ + L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, + L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, + L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, + L, L, L, L, L, L, L, + ]; // If the modulus is a constant number, the compiler will use crazy math to transform this into // a sequence of cheap arithmetic operations rather than using the slow modulo instruction.