diff --git a/ci/test.sh b/ci/test.sh index 3994d05f0..6a9ac6c0b 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -36,8 +36,11 @@ if [[ "$RUST_VERSION" == "nightly"* ]]; then cd crossbeam-epoch cargo clean + # TODO: Once `cfg(sanitize = "..")` is stable, replace + # `cfg(crossbeam_sanitize)` with `cfg(sanitize = "..")` and remove + # `--cfg crossbeam_sanitize`. ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0" \ - RUSTFLAGS="-Z sanitizer=address" \ + RUSTFLAGS="-Z sanitizer=address --cfg crossbeam_sanitize" \ cargo run \ --release \ --target x86_64-unknown-linux-gnu \ diff --git a/crossbeam-epoch/Cargo.toml b/crossbeam-epoch/Cargo.toml index a0091612f..e24ac8738 100644 --- a/crossbeam-epoch/Cargo.toml +++ b/crossbeam-epoch/Cargo.toml @@ -33,9 +33,6 @@ alloc = [] # of crossbeam may make breaking changes to them at any time. nightly = ["crossbeam-utils/nightly", "const_fn"] -# TODO: docs -sanitize = [] # Makes it more likely to trigger any potential data races. - [dependencies] cfg-if = "1" const_fn = { version = "0.4.4", optional = true } diff --git a/crossbeam-epoch/src/internal.rs b/crossbeam-epoch/src/internal.rs index 6ad5b2236..4da5d0268 100644 --- a/crossbeam-epoch/src/internal.rs +++ b/crossbeam-epoch/src/internal.rs @@ -55,9 +55,9 @@ use crate::sync::list::{Entry, IsElement, IterError, List}; use crate::sync::queue::Queue; /// Maximum number of objects a bag can contain. -#[cfg(not(feature = "sanitize"))] +#[cfg(not(crossbeam_sanitize))] const MAX_OBJECTS: usize = 62; -#[cfg(feature = "sanitize")] +#[cfg(crossbeam_sanitize)] const MAX_OBJECTS: usize = 4; /// A bag of deferred functions. @@ -109,7 +109,7 @@ impl Default for Bag { #[rustfmt::skip] fn default() -> Self { // TODO: [no_op; MAX_OBJECTS] syntax blocked by https://github.com/rust-lang/rust/issues/49147 - #[cfg(not(feature = "sanitize"))] + #[cfg(not(crossbeam_sanitize))] return Bag { len: 0, deferreds: [ @@ -177,7 +177,7 @@ impl Default for Bag { Deferred::new(no_op_func), ], }; - #[cfg(feature = "sanitize")] + #[cfg(crossbeam_sanitize)] return Bag { len: 0, deferreds: [ @@ -278,7 +278,7 @@ impl Global { pub(crate) fn collect(&self, guard: &Guard) { let global_epoch = self.try_advance(guard); - let steps = if cfg!(feature = "sanitize") { + let steps = if cfg!(crossbeam_sanitize) { usize::max_value() } else { Self::COLLECT_STEPS