rollup merge of #20309: sfackler/refcell-send

Also get rid of NoSync markers since UnsafeCell is now not Sync

r? @alexcrichton
This commit is contained in:
Alex Crichton 2014-12-29 16:36:54 -08:00
commit 731fcfc289

View File

@ -158,7 +158,7 @@
use clone::Clone; use clone::Clone;
use cmp::PartialEq; use cmp::PartialEq;
use default::Default; use default::Default;
use kinds::{marker, Copy}; use kinds::{Copy, Send};
use ops::{Deref, DerefMut, Drop}; use ops::{Deref, DerefMut, Drop};
use option::Option; use option::Option;
use option::Option::{None, Some}; use option::Option::{None, Some};
@ -167,7 +167,6 @@ use option::Option::{None, Some};
#[stable] #[stable]
pub struct Cell<T> { pub struct Cell<T> {
value: UnsafeCell<T>, value: UnsafeCell<T>,
noshare: marker::NoSync,
} }
impl<T:Copy> Cell<T> { impl<T:Copy> Cell<T> {
@ -176,7 +175,6 @@ impl<T:Copy> Cell<T> {
pub fn new(value: T) -> Cell<T> { pub fn new(value: T) -> Cell<T> {
Cell { Cell {
value: UnsafeCell::new(value), value: UnsafeCell::new(value),
noshare: marker::NoSync,
} }
} }
@ -208,6 +206,9 @@ impl<T:Copy> Cell<T> {
} }
} }
#[stable]
unsafe impl<T> Send for Cell<T> where T: Send {}
#[stable] #[stable]
impl<T:Copy> Clone for Cell<T> { impl<T:Copy> Clone for Cell<T> {
fn clone(&self) -> Cell<T> { fn clone(&self) -> Cell<T> {
@ -235,7 +236,6 @@ impl<T:PartialEq + Copy> PartialEq for Cell<T> {
pub struct RefCell<T> { pub struct RefCell<T> {
value: UnsafeCell<T>, value: UnsafeCell<T>,
borrow: Cell<BorrowFlag>, borrow: Cell<BorrowFlag>,
noshare: marker::NoSync,
} }
// Values [1, MAX-1] represent the number of `Ref` active // Values [1, MAX-1] represent the number of `Ref` active
@ -251,7 +251,6 @@ impl<T> RefCell<T> {
RefCell { RefCell {
value: UnsafeCell::new(value), value: UnsafeCell::new(value),
borrow: Cell::new(UNUSED), borrow: Cell::new(UNUSED),
noshare: marker::NoSync,
} }
} }
@ -341,6 +340,9 @@ impl<T> RefCell<T> {
} }
} }
#[stable]
unsafe impl<T> Send for RefCell<T> where T: Send {}
#[stable] #[stable]
impl<T: Clone> Clone for RefCell<T> { impl<T: Clone> Clone for RefCell<T> {
fn clone(&self) -> RefCell<T> { fn clone(&self) -> RefCell<T> {