Skip to content

Commit ae5ca20

Browse files
bors[bot]taiki-e
andauthored
Merge #658
658: Rename cfg(loom_crossbeam) to cfg(crossbeam_loom) r=jonhoo a=taiki-e It matches with the convention that *will* be documented in `loom`. See #487 (comment) for more. r? @jeehoonkang @jonhoo Co-authored-by: Taiki Endo <[email protected]>
2 parents d6eb687 + a9ff35f commit ae5ca20

18 files changed

+42
-42
lines changed

ci/crossbeam-epoch-loom.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
cd "$(dirname "$0")"/../crossbeam-epoch
44
set -ex
55

6-
export RUSTFLAGS="-D warnings --cfg loom_crossbeam --cfg crossbeam_sanitize"
6+
export RUSTFLAGS="-D warnings --cfg crossbeam_loom --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,

crossbeam-epoch/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ memoffset = "0.6"
4141
#
4242
# This configuration option is outside of the normal semver guarantees: minor
4343
# versions of crossbeam may make breaking changes to it at any time.
44-
[target.'cfg(loom_crossbeam)'.dependencies]
44+
[target.'cfg(crossbeam_loom)'.dependencies]
4545
loom = "0.4"
4646

4747
[dependencies.crossbeam-utils]

crossbeam-epoch/src/atomic.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ impl<T: ?Sized + Pointable> Atomic<T> {
339339
/// let a = Atomic::<i32>::null();
340340
/// ```
341341
///
342-
#[cfg_attr(all(feature = "nightly", not(loom_crossbeam)), const_fn::const_fn)]
342+
#[cfg_attr(all(feature = "nightly", not(crossbeam_loom)), const_fn::const_fn)]
343343
pub fn null() -> Atomic<T> {
344344
Self {
345345
data: AtomicUsize::new(0),
@@ -794,14 +794,14 @@ impl<T: ?Sized + Pointable> Atomic<T> {
794794
/// }
795795
/// ```
796796
pub unsafe fn into_owned(self) -> Owned<T> {
797-
#[cfg(loom_crossbeam)]
797+
#[cfg(crossbeam_loom)]
798798
{
799799
// FIXME: loom does not yet support into_inner, so we use unsync_load for now,
800800
// which should have the same synchronization properties:
801801
// https://github.com/tokio-rs/loom/issues/117
802802
Owned::from_usize(self.data.unsync_load())
803803
}
804-
#[cfg(not(loom_crossbeam))]
804+
#[cfg(not(crossbeam_loom))]
805805
{
806806
Owned::from_usize(self.data.into_inner())
807807
}
@@ -1524,7 +1524,7 @@ impl<T: ?Sized + Pointable> Default for Shared<'_, T> {
15241524
}
15251525
}
15261526

1527-
#[cfg(all(test, not(loom_crossbeam)))]
1527+
#[cfg(all(test, not(crossbeam_loom)))]
15281528
mod tests {
15291529
use super::Shared;
15301530

crossbeam-epoch/src/collector.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
/// ```
1515
use core::fmt;
1616

17-
use crate::primitive::sync::Arc;
1817
use crate::guard::Guard;
1918
use crate::internal::{Global, Local};
19+
use crate::primitive::sync::Arc;
2020

2121
/// An epoch-based garbage collector.
2222
pub struct Collector {
@@ -109,7 +109,7 @@ impl fmt::Debug for LocalHandle {
109109
}
110110
}
111111

112-
#[cfg(all(test, not(loom_crossbeam)))]
112+
#[cfg(all(test, not(crossbeam_loom)))]
113113
mod tests {
114114
use std::mem;
115115
use std::sync::atomic::{AtomicUsize, Ordering};

crossbeam-epoch/src/default.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
//! destructed on thread exit, which in turn unregisters the thread.
66
77
use crate::collector::{Collector, LocalHandle};
8-
use crate::primitive::{lazy_static, thread_local};
98
use crate::guard::Guard;
9+
use crate::primitive::{lazy_static, thread_local};
1010

1111
lazy_static! {
1212
/// The global data for the default garbage collector.
@@ -45,7 +45,7 @@ where
4545
.unwrap_or_else(|_| f(&COLLECTOR.register()))
4646
}
4747

48-
#[cfg(all(test, not(loom_crossbeam)))]
48+
#[cfg(all(test, not(crossbeam_loom)))]
4949
mod tests {
5050
use crossbeam_utils::thread;
5151

crossbeam-epoch/src/deferred.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl Deferred {
7979
}
8080
}
8181

82-
#[cfg(all(test, not(loom_crossbeam)))]
82+
#[cfg(all(test, not(crossbeam_loom)))]
8383
mod tests {
8484
use super::Deferred;
8585
use std::cell::Cell;

crossbeam-epoch/src/internal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ impl IsElement<Local> for Local {
625625
}
626626
}
627627

628-
#[cfg(all(test, not(loom_crossbeam)))]
628+
#[cfg(all(test, not(crossbeam_loom)))]
629629
mod tests {
630630
use std::sync::atomic::{AtomicUsize, Ordering};
631631

crossbeam-epoch/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868
use cfg_if::cfg_if;
6969

70-
#[cfg(loom_crossbeam)]
70+
#[cfg(crossbeam_loom)]
7171
#[allow(unused_imports, dead_code)]
7272
mod primitive {
7373
pub(crate) mod cell {
@@ -102,7 +102,7 @@ mod primitive {
102102
pub(crate) use loom::lazy_static;
103103
pub(crate) use loom::thread_local;
104104
}
105-
#[cfg(not(loom_crossbeam))]
105+
#[cfg(not(crossbeam_loom))]
106106
#[allow(unused_imports, dead_code)]
107107
mod primitive {
108108
#[cfg(any(feature = "alloc", feature = "std"))]

crossbeam-epoch/src/sync/list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ impl<'g, T: 'g, C: IsElement<T>> Iterator for Iter<'g, T, C> {
295295
}
296296
}
297297

298-
#[cfg(all(test, not(loom_crossbeam)))]
298+
#[cfg(all(test, not(crossbeam_loom)))]
299299
mod tests {
300300
use super::*;
301301
use crate::{Collector, Owned};

crossbeam-epoch/src/sync/queue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<T> Drop for Queue<T> {
215215
}
216216
}
217217

218-
#[cfg(all(test, not(loom_crossbeam)))]
218+
#[cfg(all(test, not(crossbeam_loom)))]
219219
mod test {
220220
use super::*;
221221
use crate::pin;

crossbeam-epoch/tests/loom.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![cfg(loom_crossbeam)]
1+
#![cfg(crossbeam_loom)]
22

33
use crossbeam_epoch as epoch;
44

crossbeam-utils/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ lazy_static = { version = "1.4.0", optional = true }
3636
#
3737
# This configuration option is outside of the normal semver guarantees: minor
3838
# versions of crossbeam may make breaking changes to it at any time.
39-
[target.'cfg(loom_crossbeam)'.dependencies]
39+
[target.'cfg(crossbeam_loom)'.dependencies]
4040
loom = "0.4"
4141

4242
[build-dependencies]

crossbeam-utils/src/atomic/atomic_cell.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ use core::fmt;
88
use core::mem;
99
use core::sync::atomic::Ordering;
1010

11-
#[cfg(not(loom_crossbeam))]
11+
#[cfg(not(crossbeam_loom))]
1212
use core::ptr;
1313

1414
#[cfg(feature = "std")]
1515
use std::panic::{RefUnwindSafe, UnwindSafe};
1616

17-
#[cfg(not(loom_crossbeam))]
17+
#[cfg(not(crossbeam_loom))]
1818
use super::seq_lock::SeqLock;
1919

2020
/// A thread-safe mutable memory location.
@@ -499,31 +499,31 @@ macro_rules! impl_arithmetic {
499499

500500
#[cfg(has_atomic_u8)]
501501
impl_arithmetic!(u8, atomic::AtomicU8, "let a = AtomicCell::new(7u8);");
502-
#[cfg(all(has_atomic_u8, not(loom_crossbeam)))]
502+
#[cfg(all(has_atomic_u8, not(crossbeam_loom)))]
503503
impl_arithmetic!(i8, atomic::AtomicI8, "let a = AtomicCell::new(7i8);");
504504
#[cfg(has_atomic_u16)]
505505
impl_arithmetic!(u16, atomic::AtomicU16, "let a = AtomicCell::new(7u16);");
506-
#[cfg(all(has_atomic_u16, not(loom_crossbeam)))]
506+
#[cfg(all(has_atomic_u16, not(crossbeam_loom)))]
507507
impl_arithmetic!(i16, atomic::AtomicI16, "let a = AtomicCell::new(7i16);");
508508
#[cfg(has_atomic_u32)]
509509
impl_arithmetic!(u32, atomic::AtomicU32, "let a = AtomicCell::new(7u32);");
510-
#[cfg(all(has_atomic_u32, not(loom_crossbeam)))]
510+
#[cfg(all(has_atomic_u32, not(crossbeam_loom)))]
511511
impl_arithmetic!(i32, atomic::AtomicI32, "let a = AtomicCell::new(7i32);");
512512
#[cfg(has_atomic_u64)]
513513
impl_arithmetic!(u64, atomic::AtomicU64, "let a = AtomicCell::new(7u64);");
514-
#[cfg(all(has_atomic_u64, not(loom_crossbeam)))]
514+
#[cfg(all(has_atomic_u64, not(crossbeam_loom)))]
515515
impl_arithmetic!(i64, atomic::AtomicI64, "let a = AtomicCell::new(7i64);");
516-
#[cfg(all(has_atomic_u128, not(loom_crossbeam)))]
516+
#[cfg(all(has_atomic_u128, not(crossbeam_loom)))]
517517
impl_arithmetic!(u128, atomic::AtomicU128, "let a = AtomicCell::new(7u128);");
518-
#[cfg(all(has_atomic_u128, not(loom_crossbeam)))]
518+
#[cfg(all(has_atomic_u128, not(crossbeam_loom)))]
519519
impl_arithmetic!(i128, atomic::AtomicI128, "let a = AtomicCell::new(7i128);");
520520

521521
impl_arithmetic!(
522522
usize,
523523
atomic::AtomicUsize,
524524
"let a = AtomicCell::new(7usize);"
525525
);
526-
#[cfg(not(loom_crossbeam))]
526+
#[cfg(not(crossbeam_loom))]
527527
impl_arithmetic!(
528528
isize,
529529
atomic::AtomicIsize,
@@ -632,7 +632,7 @@ const fn can_transmute<A, B>() -> bool {
632632
/// scalability.
633633
#[inline]
634634
#[must_use]
635-
#[cfg(not(loom_crossbeam))]
635+
#[cfg(not(crossbeam_loom))]
636636
fn lock(addr: usize) -> &'static SeqLock {
637637
// The number of locks is a prime number because we want to make sure `addr % LEN` gets
638638
// dispersed across all locks.
@@ -820,9 +820,9 @@ macro_rules! atomic {
820820
#[cfg(has_atomic_u128)]
821821
atomic!(@check, $t, atomic::AtomicU128, $a, $atomic_op);
822822

823-
#[cfg(loom_crossbeam)]
823+
#[cfg(crossbeam_loom)]
824824
unimplemented!("loom does not support non-atomic atomic ops");
825-
#[cfg(not(loom_crossbeam))]
825+
#[cfg(not(crossbeam_loom))]
826826
break $fallback_op;
827827
}
828828
};

crossbeam-utils/src/atomic/consume.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ macro_rules! impl_atomic {
5353
type Val = $val;
5454
impl_consume!();
5555
}
56-
#[cfg(loom_crossbeam)]
56+
#[cfg(crossbeam_loom)]
5757
impl AtomicConsume for ::loom::sync::atomic::$atomic {
5858
type Val = $val;
5959
impl_consume!();
@@ -63,7 +63,7 @@ macro_rules! impl_atomic {
6363

6464
impl_atomic!(AtomicBool, bool);
6565
impl_atomic!(AtomicUsize, usize);
66-
#[cfg(not(loom_crossbeam))]
66+
#[cfg(not(crossbeam_loom))]
6767
impl_atomic!(AtomicIsize, isize);
6868
#[cfg(has_atomic_u8)]
6969
impl_atomic!(AtomicU8, u8);
@@ -87,7 +87,7 @@ impl<T> AtomicConsume for ::core::sync::atomic::AtomicPtr<T> {
8787
impl_consume!();
8888
}
8989

90-
#[cfg(loom_crossbeam)]
90+
#[cfg(crossbeam_loom)]
9191
impl<T> AtomicConsume for ::loom::sync::atomic::AtomicPtr<T> {
9292
type Val = *mut T;
9393
impl_consume!();

crossbeam-utils/src/atomic/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
//! * [`AtomicCell`], a thread-safe mutable memory location.
44
//! * [`AtomicConsume`], for reading from primitive atomic types with "consume" ordering.
55
6-
#[cfg(not(loom_crossbeam))]
6+
#[cfg(not(crossbeam_loom))]
77
use cfg_if::cfg_if;
88

9-
#[cfg(not(loom_crossbeam))]
9+
#[cfg(not(crossbeam_loom))]
1010
cfg_if! {
1111
// Use "wide" sequence lock if the pointer width <= 32 for preventing its counter against wrap
1212
// around.

crossbeam-utils/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#![cfg_attr(not(feature = "std"), no_std)]
4141
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
4242

43-
#[cfg(loom_crossbeam)]
43+
#[cfg(crossbeam_loom)]
4444
#[allow(unused_imports)]
4545
mod primitive {
4646
pub(crate) mod sync {
@@ -60,7 +60,7 @@ mod primitive {
6060
pub(crate) use loom::sync::{Arc, Condvar, Mutex};
6161
}
6262
}
63-
#[cfg(not(loom_crossbeam))]
63+
#[cfg(not(crossbeam_loom))]
6464
#[allow(unused_imports)]
6565
mod primitive {
6666
pub(crate) mod sync {
@@ -109,7 +109,7 @@ cfg_if! {
109109
if #[cfg(feature = "std")] {
110110
pub mod sync;
111111

112-
#[cfg(not(loom_crossbeam))]
112+
#[cfg(not(crossbeam_loom))]
113113
pub mod thread;
114114
}
115115
}

crossbeam-utils/src/sync/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
//! * [`WaitGroup`], for synchronizing the beginning or end of some computation.
66
77
mod parker;
8-
#[cfg(not(loom_crossbeam))]
8+
#[cfg(not(crossbeam_loom))]
99
mod sharded_lock;
1010
mod wait_group;
1111

1212
pub use self::parker::{Parker, Unparker};
13-
#[cfg(not(loom_crossbeam))]
13+
#[cfg(not(crossbeam_loom))]
1414
pub use self::sharded_lock::{ShardedLock, ShardedLockReadGuard, ShardedLockWriteGuard};
1515
pub use self::wait_group::WaitGroup;

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ cfg_if! {
9090

9191
pub use crossbeam_utils::sync;
9292

93-
#[cfg(not(loom_crossbeam))]
93+
#[cfg(not(crossbeam_loom))]
9494
pub use crossbeam_utils::thread;
95-
#[cfg(not(loom_crossbeam))]
95+
#[cfg(not(crossbeam_loom))]
9696
pub use crossbeam_utils::thread::scope;
9797
}
9898
}

0 commit comments

Comments
 (0)