diff options
| author | bors <bors@rust-lang.org> | 2014-03-22 13:01:52 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-22 13:01:52 -0700 |
| commit | 7e7a5e3d3eabe0ee46474b0eb701c159a45b490f (patch) | |
| tree | 70ed4399cd98654d6ba75b4251b8478868ab063a /src/libstd | |
| parent | 0e6f90eb89021342935de9af2f014fbee5805855 (diff) | |
| parent | a1cb2f5d8c4ce807b27b09344b5ef7d9cd94c04d (diff) | |
| download | rust-7e7a5e3d3eabe0ee46474b0eb701c159a45b490f.tar.gz rust-7e7a5e3d3eabe0ee46474b0eb701c159a45b490f.zip | |
auto merge of #13076 : FlaPer87/rust/remove-freeze, r=alexcrichton
This PR removes the `Freeze` kind and the `NoFreeze` marker completely. Fixes #12577 cc @nikomatsakis r?
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/cell.rs | 16 | ||||
| -rw-r--r-- | src/libstd/comm/mod.rs | 8 | ||||
| -rw-r--r-- | src/libstd/comm/select.rs | 2 | ||||
| -rw-r--r-- | src/libstd/kinds.rs | 14 | ||||
| -rw-r--r-- | src/libstd/prelude.rs | 2 |
5 files changed, 11 insertions, 31 deletions
diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index d09b31faa25..e0912b826cd 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -22,8 +22,7 @@ use ty::Unsafe; /// A mutable memory location that admits only `Pod` data. pub struct Cell<T> { priv value: Unsafe<T>, - priv marker1: marker::NoFreeze, - priv marker2: marker::NoShare, + priv noshare: marker::NoShare, } impl<T:Pod> Cell<T> { @@ -31,8 +30,7 @@ impl<T:Pod> Cell<T> { pub fn new(value: T) -> Cell<T> { Cell { value: Unsafe::new(value), - marker1: marker::NoFreeze, - marker2: marker::NoShare, + noshare: marker::NoShare, } } @@ -73,9 +71,8 @@ impl<T: fmt::Show> fmt::Show for Cell<T> { pub struct RefCell<T> { priv value: Unsafe<T>, priv borrow: BorrowFlag, - priv marker1: marker::NoFreeze, - priv marker2: marker::NoPod, - priv marker3: marker::NoShare, + priv nopod: marker::NoPod, + priv noshare: marker::NoShare, } // Values [1, MAX-1] represent the number of `Ref` active @@ -88,10 +85,9 @@ impl<T> RefCell<T> { /// Create a new `RefCell` containing `value` pub fn new(value: T) -> RefCell<T> { RefCell { - marker1: marker::NoFreeze, - marker2: marker::NoPod, - marker3: marker::NoShare, value: Unsafe::new(value), + nopod: marker::NoPod, + noshare: marker::NoShare, borrow: UNUSED, } } diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs index e25571dd246..267140a0089 100644 --- a/src/libstd/comm/mod.rs +++ b/src/libstd/comm/mod.rs @@ -291,7 +291,7 @@ pub struct Receiver<T> { priv inner: Flavor<T>, priv receives: Cell<uint>, // can't share in an arc - priv marker: marker::NoFreeze, + priv marker: marker::NoShare, } /// An iterator over messages on a receiver, this iterator will block @@ -307,7 +307,7 @@ pub struct Sender<T> { priv inner: Flavor<T>, priv sends: Cell<uint>, // can't share in an arc - priv marker: marker::NoFreeze, + priv marker: marker::NoShare, } /// This enumeration is the list of the possible reasons that try_recv could not @@ -340,7 +340,7 @@ pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) { impl<T: Send> Sender<T> { fn my_new(inner: Flavor<T>) -> Sender<T> { - Sender { inner: inner, sends: Cell::new(0), marker: marker::NoFreeze } + Sender { inner: inner, sends: Cell::new(0), marker: marker::NoShare } } /// Sends a value along this channel to be received by the corresponding @@ -478,7 +478,7 @@ impl<T: Send> Drop for Sender<T> { impl<T: Send> Receiver<T> { fn my_new(inner: Flavor<T>) -> Receiver<T> { - Receiver { inner: inner, receives: Cell::new(0), marker: marker::NoFreeze } + Receiver { inner: inner, receives: Cell::new(0), marker: marker::NoShare } } /// Blocks waiting for a value on this receiver diff --git a/src/libstd/comm/select.rs b/src/libstd/comm/select.rs index 3e134b92493..5872c308f93 100644 --- a/src/libstd/comm/select.rs +++ b/src/libstd/comm/select.rs @@ -66,7 +66,6 @@ pub struct Select { priv tail: *mut Handle<'static, ()>, priv next_id: Cell<uint>, priv marker1: marker::NoSend, - priv marker2: marker::NoFreeze, } /// A handle to a receiver which is currently a member of a `Select` set of @@ -105,7 +104,6 @@ impl Select { pub fn new() -> Select { Select { marker1: marker::NoSend, - marker2: marker::NoFreeze, head: 0 as *mut Handle<'static, ()>, tail: 0 as *mut Handle<'static, ()>, next_id: Cell::new(1), diff --git a/src/libstd/kinds.rs b/src/libstd/kinds.rs index b44616421d1..c0a442a6141 100644 --- a/src/libstd/kinds.rs +++ b/src/libstd/kinds.rs @@ -26,12 +26,6 @@ pub trait Send { // empty. } -/// Types that are either immutable or have inherited mutability. -#[lang="freeze"] -pub trait Freeze { - // empty. -} - /// Types with a constant size known at compile-time. #[lang="sized"] pub trait Sized { @@ -225,14 +219,6 @@ pub mod marker { #[deriving(Eq,Clone)] pub struct InvariantLifetime<'a>; - /// A type which is considered "not freezable", meaning that - /// its contents could change even if stored in an immutable - /// context or it is the referent of an `&T` pointer. This is - /// typically embedded in other types, such as `Cell`. - #[lang="no_freeze_bound"] - #[deriving(Eq,Clone)] - pub struct NoFreeze; - /// A type which is considered "not sendable", meaning that it cannot /// be safely sent between tasks, even if it is owned. This is /// typically embedded in other types, such as `Gc`, to ensure that diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index f8e56cf8a2f..d487aa638ac 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -20,7 +20,7 @@ generally useful to many Rust programs. */ // Reexported core operators -pub use kinds::{Freeze, Pod, Send, Sized, Share}; +pub use kinds::{Pod, Send, Sized, Share}; pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not}; pub use ops::{BitAnd, BitOr, BitXor}; pub use ops::{Drop, Deref, DerefMut}; |
