From 88d4e02d5bbf1ea97f7f1d03bcad82de26185b68 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 29 Dec 2014 10:58:22 -0800 Subject: [PATCH] Implement Send for Cell and RefCell Also get rid of NoSync markers since UnsafeCell is now not Sync --- src/libcore/cell.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index b45424a5eed..01a1e7f9711 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -158,7 +158,7 @@ use clone::Clone; use cmp::PartialEq; use default::Default; -use kinds::{marker, Copy}; +use kinds::{Copy, Send}; use ops::{Deref, DerefMut, Drop}; use option::Option; use option::Option::{None, Some}; @@ -167,7 +167,6 @@ use option::Option::{None, Some}; #[stable] pub struct Cell { value: UnsafeCell, - noshare: marker::NoSync, } impl Cell { @@ -176,7 +175,6 @@ impl Cell { pub fn new(value: T) -> Cell { Cell { value: UnsafeCell::new(value), - noshare: marker::NoSync, } } @@ -208,6 +206,9 @@ impl Cell { } } +#[stable] +unsafe impl Send for Cell where T: Send {} + #[stable] impl Clone for Cell { fn clone(&self) -> Cell { @@ -235,7 +236,6 @@ impl PartialEq for Cell { pub struct RefCell { value: UnsafeCell, borrow: Cell, - noshare: marker::NoSync, } // Values [1, MAX-1] represent the number of `Ref` active @@ -251,7 +251,6 @@ impl RefCell { RefCell { value: UnsafeCell::new(value), borrow: Cell::new(UNUSED), - noshare: marker::NoSync, } } @@ -341,6 +340,9 @@ impl RefCell { } } +#[stable] +unsafe impl Send for RefCell where T: Send {} + #[stable] impl Clone for RefCell { fn clone(&self) -> RefCell {