Skip to content

Commit 4d47cd2

Browse files
bors[bot]Stjepan Glavina
and
Stjepan Glavina
committed
Merge #262
262: Move AtomicCell into crossbeam-utils r=stjepang a=stjepang At this point, I feel pretty confident about the current state of `AtomicCell` in the sense that we probably won't make any breaking changes to its public API in the future. It's also a reasonably small utility without dependencies that deserves living in `crossbeam-utils`. The Rust compiler would like to use it in place of its `LockCell`, and already has `crossbeam-utils` whitelisted. See [this PR](rust-lang/rust#56614 (comment)). Let's move `AtomicCell` into `crossbeam-utils` so that people can use it without depending on whole `crossbeam`. Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
2 parents a3252af + 7afa01a commit 4d47cd2

File tree

4 files changed

+27
-26
lines changed

4 files changed

+27
-26
lines changed

src/atomic_cell.rs crossbeam-utils/src/atomic/atomic_cell.rs

+22-22
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<T> AtomicCell<T> {
3333
/// # Examples
3434
///
3535
/// ```
36-
/// use crossbeam::atomic::AtomicCell;
36+
/// use crossbeam_utils::atomic::AtomicCell;
3737
///
3838
/// let a = AtomicCell::new(7);
3939
/// ```
@@ -48,7 +48,7 @@ impl<T> AtomicCell<T> {
4848
/// # Examples
4949
///
5050
/// ```
51-
/// use crossbeam::atomic::AtomicCell;
51+
/// use crossbeam_utils::atomic::AtomicCell;
5252
///
5353
/// let mut a = AtomicCell::new(7);
5454
/// *a.get_mut() += 1;
@@ -64,7 +64,7 @@ impl<T> AtomicCell<T> {
6464
/// # Examples
6565
///
6666
/// ```
67-
/// use crossbeam::atomic::AtomicCell;
67+
/// use crossbeam_utils::atomic::AtomicCell;
6868
///
6969
/// let mut a = AtomicCell::new(7);
7070
/// let v = a.into_inner();
@@ -83,7 +83,7 @@ impl<T> AtomicCell<T> {
8383
/// # Examples
8484
///
8585
/// ```
86-
/// use crossbeam::atomic::AtomicCell;
86+
/// use crossbeam_utils::atomic::AtomicCell;
8787
///
8888
/// // This type is internally represented as `AtomicUsize` so we can just use atomic
8989
/// // operations provided by it.
@@ -112,7 +112,7 @@ impl<T> AtomicCell<T> {
112112
/// # Examples
113113
///
114114
/// ```
115-
/// use crossbeam::atomic::AtomicCell;
115+
/// use crossbeam_utils::atomic::AtomicCell;
116116
///
117117
/// let a = AtomicCell::new(7);
118118
///
@@ -135,7 +135,7 @@ impl<T> AtomicCell<T> {
135135
/// # Examples
136136
///
137137
/// ```
138-
/// use crossbeam::atomic::AtomicCell;
138+
/// use crossbeam_utils::atomic::AtomicCell;
139139
///
140140
/// let a = AtomicCell::new(7);
141141
///
@@ -154,7 +154,7 @@ impl<T: Copy> AtomicCell<T> {
154154
/// # Examples
155155
///
156156
/// ```
157-
/// use crossbeam::atomic::AtomicCell;
157+
/// use crossbeam_utils::atomic::AtomicCell;
158158
///
159159
/// let a = AtomicCell::new(7);
160160
///
@@ -174,7 +174,7 @@ impl<T: Copy + Eq> AtomicCell<T> {
174174
/// # Examples
175175
///
176176
/// ```
177-
/// use crossbeam::atomic::AtomicCell;
177+
/// use crossbeam_utils::atomic::AtomicCell;
178178
///
179179
/// let a = AtomicCell::new(1);
180180
///
@@ -199,7 +199,7 @@ impl<T: Copy + Eq> AtomicCell<T> {
199199
/// # Examples
200200
///
201201
/// ```
202-
/// use crossbeam::atomic::AtomicCell;
202+
/// use crossbeam_utils::atomic::AtomicCell;
203203
///
204204
/// let a = AtomicCell::new(1);
205205
///
@@ -239,7 +239,7 @@ macro_rules! impl_arithmetic {
239239
/// # Examples
240240
///
241241
/// ```
242-
/// use crossbeam::atomic::AtomicCell;
242+
/// use crossbeam_utils::atomic::AtomicCell;
243243
///
244244
#[doc = $example]
245245
///
@@ -267,7 +267,7 @@ macro_rules! impl_arithmetic {
267267
/// # Examples
268268
///
269269
/// ```
270-
/// use crossbeam::atomic::AtomicCell;
270+
/// use crossbeam_utils::atomic::AtomicCell;
271271
///
272272
#[doc = $example]
273273
///
@@ -293,7 +293,7 @@ macro_rules! impl_arithmetic {
293293
/// # Examples
294294
///
295295
/// ```
296-
/// use crossbeam::atomic::AtomicCell;
296+
/// use crossbeam_utils::atomic::AtomicCell;
297297
///
298298
#[doc = $example]
299299
///
@@ -319,7 +319,7 @@ macro_rules! impl_arithmetic {
319319
/// # Examples
320320
///
321321
/// ```
322-
/// use crossbeam::atomic::AtomicCell;
322+
/// use crossbeam_utils::atomic::AtomicCell;
323323
///
324324
#[doc = $example]
325325
///
@@ -345,7 +345,7 @@ macro_rules! impl_arithmetic {
345345
/// # Examples
346346
///
347347
/// ```
348-
/// use crossbeam::atomic::AtomicCell;
348+
/// use crossbeam_utils::atomic::AtomicCell;
349349
///
350350
#[doc = $example]
351351
///
@@ -376,7 +376,7 @@ macro_rules! impl_arithmetic {
376376
/// # Examples
377377
///
378378
/// ```
379-
/// use crossbeam::atomic::AtomicCell;
379+
/// use crossbeam_utils::atomic::AtomicCell;
380380
///
381381
#[doc = $example]
382382
///
@@ -396,7 +396,7 @@ macro_rules! impl_arithmetic {
396396
/// # Examples
397397
///
398398
/// ```
399-
/// use crossbeam::atomic::AtomicCell;
399+
/// use crossbeam_utils::atomic::AtomicCell;
400400
///
401401
#[doc = $example]
402402
///
@@ -414,7 +414,7 @@ macro_rules! impl_arithmetic {
414414
/// # Examples
415415
///
416416
/// ```
417-
/// use crossbeam::atomic::AtomicCell;
417+
/// use crossbeam_utils::atomic::AtomicCell;
418418
///
419419
#[doc = $example]
420420
///
@@ -432,7 +432,7 @@ macro_rules! impl_arithmetic {
432432
/// # Examples
433433
///
434434
/// ```
435-
/// use crossbeam::atomic::AtomicCell;
435+
/// use crossbeam_utils::atomic::AtomicCell;
436436
///
437437
#[doc = $example]
438438
///
@@ -450,7 +450,7 @@ macro_rules! impl_arithmetic {
450450
/// # Examples
451451
///
452452
/// ```
453-
/// use crossbeam::atomic::AtomicCell;
453+
/// use crossbeam_utils::atomic::AtomicCell;
454454
///
455455
#[doc = $example]
456456
///
@@ -505,7 +505,7 @@ impl AtomicCell<bool> {
505505
/// # Examples
506506
///
507507
/// ```
508-
/// use crossbeam::atomic::AtomicCell;
508+
/// use crossbeam_utils::atomic::AtomicCell;
509509
///
510510
/// let a = AtomicCell::new(true);
511511
///
@@ -526,7 +526,7 @@ impl AtomicCell<bool> {
526526
/// # Examples
527527
///
528528
/// ```
529-
/// use crossbeam::atomic::AtomicCell;
529+
/// use crossbeam_utils::atomic::AtomicCell;
530530
///
531531
/// let a = AtomicCell::new(false);
532532
///
@@ -547,7 +547,7 @@ impl AtomicCell<bool> {
547547
/// # Examples
548548
///
549549
/// ```
550-
/// use crossbeam::atomic::AtomicCell;
550+
/// use crossbeam_utils::atomic::AtomicCell;
551551
///
552552
/// let a = AtomicCell::new(true);
553553
///

crossbeam-utils/src/atomic/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! Additional utilities for atomics.
22
3+
mod atomic_cell;
34
mod consume;
45

6+
pub use self::atomic_cell::AtomicCell;
57
pub use self::consume::AtomicConsume;

tests/atomic_cell.rs crossbeam-utils/tests/atomic_cell.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
extern crate crossbeam;
1+
extern crate crossbeam_utils;
22

33
use std::sync::atomic::AtomicUsize;
44
use std::sync::atomic::Ordering::SeqCst;
55

6-
use crossbeam::atomic::AtomicCell;
6+
use crossbeam_utils::atomic::AtomicCell;
77

88
#[test]
99
fn is_lock_free() {

src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,13 @@ mod _epoch {
5959
pub use _epoch::crossbeam_epoch as epoch;
6060

6161
mod arc_cell;
62-
mod atomic_cell;
6362

6463
extern crate crossbeam_utils;
6564

6665
/// Additional utilities for atomics.
6766
pub mod atomic {
6867
pub use arc_cell::ArcCell;
69-
pub use atomic_cell::AtomicCell;
68+
pub use crossbeam_utils::atomic::AtomicCell;
7069
pub use crossbeam_utils::atomic::AtomicConsume;
7170
}
7271

0 commit comments

Comments
 (0)