Skip to content

Commit 731fcfc

Browse files
committed
rollup merge of rust-lang#20309: sfackler/refcell-send
Also get rid of NoSync markers since UnsafeCell is now not Sync r? @alexcrichton
2 parents 79db01a + 88d4e02 commit 731fcfc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/libcore/cell.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
use clone::Clone;
159159
use cmp::PartialEq;
160160
use default::Default;
161-
use kinds::{marker, Copy};
161+
use kinds::{Copy, Send};
162162
use ops::{Deref, DerefMut, Drop};
163163
use option::Option;
164164
use option::Option::{None, Some};
@@ -167,7 +167,6 @@ use option::Option::{None, Some};
167167
#[stable]
168168
pub struct Cell<T> {
169169
value: UnsafeCell<T>,
170-
noshare: marker::NoSync,
171170
}
172171

173172
impl<T:Copy> Cell<T> {
@@ -176,7 +175,6 @@ impl<T:Copy> Cell<T> {
176175
pub fn new(value: T) -> Cell<T> {
177176
Cell {
178177
value: UnsafeCell::new(value),
179-
noshare: marker::NoSync,
180178
}
181179
}
182180

@@ -208,6 +206,9 @@ impl<T:Copy> Cell<T> {
208206
}
209207
}
210208

209+
#[stable]
210+
unsafe impl<T> Send for Cell<T> where T: Send {}
211+
211212
#[stable]
212213
impl<T:Copy> Clone for Cell<T> {
213214
fn clone(&self) -> Cell<T> {
@@ -235,7 +236,6 @@ impl<T:PartialEq + Copy> PartialEq for Cell<T> {
235236
pub struct RefCell<T> {
236237
value: UnsafeCell<T>,
237238
borrow: Cell<BorrowFlag>,
238-
noshare: marker::NoSync,
239239
}
240240

241241
// Values [1, MAX-1] represent the number of `Ref` active
@@ -251,7 +251,6 @@ impl<T> RefCell<T> {
251251
RefCell {
252252
value: UnsafeCell::new(value),
253253
borrow: Cell::new(UNUSED),
254-
noshare: marker::NoSync,
255254
}
256255
}
257256

@@ -341,6 +340,9 @@ impl<T> RefCell<T> {
341340
}
342341
}
343342

343+
#[stable]
344+
unsafe impl<T> Send for RefCell<T> where T: Send {}
345+
344346
#[stable]
345347
impl<T: Clone> Clone for RefCell<T> {
346348
fn clone(&self) -> RefCell<T> {

0 commit comments

Comments
 (0)