Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make loom dependency optional #666

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/crossbeam-epoch-loom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export RUSTFLAGS="-D warnings --cfg crossbeam_loom --cfg crossbeam_sanitize"
# With MAX_PREEMPTIONS=2 the loom tests (currently) take around 11m.
# If we were to run with =3, they would take several times that,
# which is probably too costly for CI.
env LOOM_MAX_PREEMPTIONS=2 cargo test --test loom --release -- --nocapture
env LOOM_MAX_PREEMPTIONS=2 cargo test --test loom --release --features loom -- --nocapture
8 changes: 7 additions & 1 deletion crossbeam-epoch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ alloc = []
# of crossbeam may make breaking changes to them at any time.
nightly = ["crossbeam-utils/nightly", "const_fn"]

# Enable the use of loom for concurrency testing.
#
# This configuration option is outside of the normal semver guarantees: minor
# versions of crossbeam may make breaking changes to it at any time.
loom = ["loom-crate", "crossbeam-utils/loom"]

[dependencies]
cfg-if = "1"
const_fn = { version = "0.4.4", optional = true }
Expand All @@ -42,7 +48,7 @@ memoffset = "0.6"
# This configuration option is outside of the normal semver guarantees: minor
# versions of crossbeam may make breaking changes to it at any time.
[target.'cfg(crossbeam_loom)'.dependencies]
loom = "0.4"
loom-crate = { package = "loom", version = "0.4", optional = true }

[dependencies.crossbeam-utils]
version = "0.8"
Expand Down
3 changes: 3 additions & 0 deletions crossbeam-epoch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
#![cfg_attr(feature = "nightly", feature(const_fn))]

#[cfg(crossbeam_loom)]
extern crate loom_crate as loom;

use cfg_if::cfg_if;

#[cfg(crossbeam_loom)]
Expand Down
1 change: 1 addition & 0 deletions crossbeam-epoch/tests/loom.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![cfg(crossbeam_loom)]

use crossbeam_epoch as epoch;
use loom_crate as loom;

use epoch::*;
use epoch::{Atomic, Owned};
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ lazy_static = { version = "1.4.0", optional = true }
# This configuration option is outside of the normal semver guarantees: minor
# versions of crossbeam may make breaking changes to it at any time.
[target.'cfg(crossbeam_loom)'.dependencies]
loom = "0.4"
loom = { version = "0.4", optional = true }

[build-dependencies]
autocfg = "1.0.0"
Expand Down