From 614b311e9657c75d6ccec73019d902d209ffd557 Mon Sep 17 00:00:00 2001 From: Serge Barral Date: Sun, 8 Sep 2024 21:08:28 +0200 Subject: [PATCH] Update loom to 0.7, make it a dev dependency --- Cargo.toml | 12 ++++++------ src/loom_exports.rs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 876292c..e798655 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,12 @@ oorandom = "11.1" crossbeam-deque = "0.8" num_cpus = "1.13" +[target.'cfg(st3_loom)'.dev-dependencies] +loom = "0.7" + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(st3_loom)'] } + [[bench]] name = "benchmark" path = "benches/benchmark.rs" @@ -37,9 +43,3 @@ harness = false [[test]] name = "integration" path = "tests/tests.rs" - -[target.'cfg(st3_loom)'.dependencies] -loom = "0.5" - -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(st3_loom)'] } diff --git a/src/loom_exports.rs b/src/loom_exports.rs index ddda519..0198976 100644 --- a/src/loom_exports.rs +++ b/src/loom_exports.rs @@ -1,4 +1,4 @@ -#[cfg(st3_loom)] +#[cfg(all(test, st3_loom))] #[allow(unused_imports)] pub(crate) mod sync { pub(crate) mod atomic { @@ -9,7 +9,7 @@ pub(crate) mod sync { pub(crate) use loom::sync::atomic::AtomicU64; } } -#[cfg(not(st3_loom))] +#[cfg(not(all(test, st3_loom)))] #[allow(unused_imports)] pub(crate) mod sync { pub(crate) mod atomic { @@ -21,11 +21,11 @@ pub(crate) mod sync { } } -#[cfg(st3_loom)] +#[cfg(all(test, st3_loom))] pub(crate) mod cell { pub(crate) use loom::cell::UnsafeCell; } -#[cfg(not(st3_loom))] +#[cfg(not(all(test, st3_loom)))] pub(crate) mod cell { #[derive(Debug)] pub(crate) struct UnsafeCell(core::cell::UnsafeCell); @@ -46,11 +46,11 @@ pub(crate) mod cell { #[allow(unused_macros)] macro_rules! debug_or_loom_assert { - ($($arg:tt)*) => (if cfg!(any(debug_assertions, st3_loom)) { assert!($($arg)*); }) + ($($arg:tt)*) => (if cfg!(any(debug_assertions, all(test, st3_loom))) { assert!($($arg)*); }) } #[allow(unused_macros)] macro_rules! debug_or_loom_assert_eq { - ($($arg:tt)*) => (if cfg!(any(debug_assertions, st3_loom)) { assert_eq!($($arg)*); }) + ($($arg:tt)*) => (if cfg!(any(debug_assertions, all(test, st3_loom))) { assert_eq!($($arg)*); }) } #[allow(unused_imports)] pub(crate) use debug_or_loom_assert;