Skip to content

Commit

Permalink
Merge pull request #10 from asynchronics/feature/loom-as-dev-dep
Browse files Browse the repository at this point in the history
Update loom to 0.7, make it a dev dependency
  • Loading branch information
sbarral authored Sep 8, 2024
2 parents f4eac85 + 614b311 commit 4b9c99c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)'] }
12 changes: 6 additions & 6 deletions src/loom_exports.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(st3_loom)]
#[cfg(all(test, st3_loom))]
#[allow(unused_imports)]
pub(crate) mod sync {
pub(crate) mod atomic {
Expand All @@ -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 {
Expand All @@ -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<T>(core::cell::UnsafeCell<T>);
Expand All @@ -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;
Expand Down

0 comments on commit 4b9c99c

Please sign in to comment.