Skip to content

Commit a61198b

Browse files
committed
Replace sanitize feature with cfg(crossbeam_sanitize)
Feature flag can be accidentally enabled by --all-features, so use cfg instead.
1 parent b8017c1 commit a61198b

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

ci/crossbeam-epoch-loom.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
cd "$(dirname "$0")"/../crossbeam-epoch
44
set -ex
55

6-
export RUSTFLAGS="-D warnings --cfg=loom_crossbeam"
6+
export RUSTFLAGS="-D warnings --cfg loom_crossbeam --cfg crossbeam_sanitize"
77

88
# With MAX_PREEMPTIONS=2 the loom tests (currently) take around 11m.
99
# If we were to run with =3, they would take several times that,
1010
# which is probably too costly for CI.
11-
env LOOM_MAX_PREEMPTIONS=2 cargo test --test loom --features sanitize --release -- --nocapture
11+
env LOOM_MAX_PREEMPTIONS=2 cargo test --test loom --release -- --nocapture

ci/test.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ if [[ "$RUST_VERSION" == "nightly"* ]]; then
3636
cd crossbeam-epoch
3737
cargo clean
3838

39+
# TODO: Once `cfg(sanitize = "..")` is stable, replace
40+
# `cfg(crossbeam_sanitize)` with `cfg(sanitize = "..")` and remove
41+
# `--cfg crossbeam_sanitize`.
3942
ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0" \
40-
RUSTFLAGS="-Z sanitizer=address" \
43+
RUSTFLAGS="-Z sanitizer=address --cfg crossbeam_sanitize" \
4144
cargo run \
4245
--release \
4346
--target x86_64-unknown-linux-gnu \

crossbeam-epoch/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ alloc = []
3333
# of crossbeam may make breaking changes to them at any time.
3434
nightly = ["crossbeam-utils/nightly", "const_fn"]
3535

36-
# TODO: docs
37-
sanitize = [] # Makes it more likely to trigger any potential data races.
38-
3936
[dependencies]
4037
cfg-if = "1"
4138
const_fn = { version = "0.4.4", optional = true }

crossbeam-epoch/src/internal.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ use crate::sync::list::{Entry, IsElement, IterError, List};
5555
use crate::sync::queue::Queue;
5656

5757
/// Maximum number of objects a bag can contain.
58-
#[cfg(not(feature = "sanitize"))]
58+
#[cfg(not(crossbeam_sanitize))]
5959
const MAX_OBJECTS: usize = 62;
60-
#[cfg(feature = "sanitize")]
60+
#[cfg(crossbeam_sanitize)]
6161
const MAX_OBJECTS: usize = 4;
6262

6363
/// A bag of deferred functions.
@@ -109,7 +109,7 @@ impl Default for Bag {
109109
#[rustfmt::skip]
110110
fn default() -> Self {
111111
// TODO: [no_op; MAX_OBJECTS] syntax blocked by https://github.com/rust-lang/rust/issues/49147
112-
#[cfg(not(feature = "sanitize"))]
112+
#[cfg(not(crossbeam_sanitize))]
113113
return Bag {
114114
len: 0,
115115
deferreds: [
@@ -177,7 +177,7 @@ impl Default for Bag {
177177
Deferred::new(no_op_func),
178178
],
179179
};
180-
#[cfg(feature = "sanitize")]
180+
#[cfg(crossbeam_sanitize)]
181181
return Bag {
182182
len: 0,
183183
deferreds: [
@@ -278,7 +278,7 @@ impl Global {
278278
pub(crate) fn collect(&self, guard: &Guard) {
279279
let global_epoch = self.try_advance(guard);
280280

281-
let steps = if cfg!(feature = "sanitize") {
281+
let steps = if cfg!(crossbeam_sanitize) {
282282
usize::max_value()
283283
} else {
284284
Self::COLLECT_STEPS

0 commit comments

Comments
 (0)