Skip to content

Commit 1c7ade9

Browse files
committed
rollup merge of #24329: GuillaumeGomez/atomicbool
Fixes #24319.
2 parents 34603b0 + f1515fa commit 1c7ade9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/libcore/atomic.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,20 @@ use intrinsics;
7878
use cell::UnsafeCell;
7979
use marker::PhantomData;
8080

81+
use default::Default;
82+
8183
/// A boolean type which can be safely shared between threads.
8284
#[stable(feature = "rust1", since = "1.0.0")]
8385
pub struct AtomicBool {
8486
v: UnsafeCell<usize>,
8587
}
8688

89+
impl Default for AtomicBool {
90+
fn default() -> AtomicBool {
91+
ATOMIC_BOOL_INIT
92+
}
93+
}
94+
8795
unsafe impl Sync for AtomicBool {}
8896

8997
/// A signed integer type which can be safely shared between threads.
@@ -92,6 +100,12 @@ pub struct AtomicIsize {
92100
v: UnsafeCell<isize>,
93101
}
94102

103+
impl Default for AtomicIsize {
104+
fn default() -> AtomicIsize {
105+
ATOMIC_ISIZE_INIT
106+
}
107+
}
108+
95109
unsafe impl Sync for AtomicIsize {}
96110

97111
/// An unsigned integer type which can be safely shared between threads.
@@ -100,6 +114,12 @@ pub struct AtomicUsize {
100114
v: UnsafeCell<usize>,
101115
}
102116

117+
impl Default for AtomicUsize {
118+
fn default() -> AtomicUsize {
119+
ATOMIC_USIZE_INIT
120+
}
121+
}
122+
103123
unsafe impl Sync for AtomicUsize {}
104124

105125
/// A raw pointer type which can be safely shared between threads.

0 commit comments

Comments
 (0)