Skip to content

Commit f2ef0f9

Browse files
committed
Add atomic module to alloc::sync
1 parent 8af675a commit f2ef0f9

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/liballoc/sync.rs

+20-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//! [arc]: struct.Arc.html
88
99
use core::any::Any;
10-
use core::sync::atomic;
1110
use core::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst};
1211
use core::borrow;
1312
use core::fmt;
@@ -29,6 +28,26 @@ use crate::rc::is_dangling;
2928
use crate::string::String;
3029
use crate::vec::Vec;
3130

31+
// Since the current `liballoc` is not a superset of `libcore`,
32+
// using `pub use core::sync::atomic;` will fail with some link errors.
33+
// If `liballoc` becomes a superset of `libcore`, replace this with
34+
// `pub use core::sync::atomic;`.
35+
/// Atomic types
36+
///
37+
/// Atomic types provide primitive shared-memory communication between
38+
/// threads, and are the building blocks of other concurrent
39+
/// types.
40+
///
41+
/// See [`std::sync::atomic`][atomic] for more details.
42+
///
43+
/// [atomic]: ../../../std/sync/atomic/index.html
44+
#[stable(feature = "rust1", since = "1.0.0")]
45+
pub mod atomic {
46+
#[stable(feature = "rust1", since = "1.0.0")]
47+
#[doc(inline)]
48+
pub use core::sync::atomic::*;
49+
}
50+
3251
/// A soft limit on the amount of references that may be made to an `Arc`.
3352
///
3453
/// Going above this limit will abort your program (although not

0 commit comments

Comments
 (0)