about summary refs log tree commit diff
path: root/src/libsync/lock.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-07-23 19:10:12 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-07-26 13:12:20 -0700
commite5da6a71a6a0b46dd3630fc8326e6d5906a1fde6 (patch)
tree9ec196a49577039b0800125f2cef1f8afa925ece /src/libsync/lock.rs
parent7aa407958b8ab2aec16b0182f0103ad92380b5dc (diff)
downloadrust-e5da6a71a6a0b46dd3630fc8326e6d5906a1fde6.tar.gz
rust-e5da6a71a6a0b46dd3630fc8326e6d5906a1fde6.zip
std: Stabilize unit, bool, ty, tuple, arc, any
This commit applies stability attributes to the contents of these modules,
summarized here:

* The `unit` and `bool` modules have become #[unstable] as they are purely meant
  for documentation purposes and are candidates for removal.

* The `ty` module has been deprecated, and the inner `Unsafe` type has been
  renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field
  has been removed as the compiler now always infers `UnsafeCell` to be
  invariant. The `new` method i stable, but the `value` field, `get` and
  `unwrap` methods are all unstable.

* The `tuple` module has its name as stable, the naming of the `TupleN` traits
  as stable while the methods are all #[unstable]. The other impls in the module
  have appropriate stability for the corresponding trait.

* The `arc` module has received the exact same treatment as the `rc` module
  previously did.

* The `any` module has its name as stable. The `Any` trait is also stable, with
  a new private supertrait which now contains the `get_type_id` method. This is
  to make the method a private implementation detail rather than a public-facing
  detail.

  The two extension traits in the module are marked #[unstable] as they will not
  be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods
  have been renamed to downcast_{mut,ref} and are #[unstable].

  The extension trait `BoxAny` has been clarified as to why it is unstable as it
  will not be necessary with DST.

This is a breaking change because the `marker1` field was removed from the
`UnsafeCell` type. To deal with this change, you can simply delete the field and
only specify the value of the `data` field in static initializers.

[breaking-change]
Diffstat (limited to 'src/libsync/lock.rs')
-rw-r--r--src/libsync/lock.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libsync/lock.rs b/src/libsync/lock.rs
index 1d119bafea1..e8418f9668f 100644
--- a/src/libsync/lock.rs
+++ b/src/libsync/lock.rs
@@ -21,7 +21,7 @@
 
 use core::prelude::*;
 
-use core::ty::Unsafe;
+use core::cell::UnsafeCell;
 use rustrt::local::Local;
 use rustrt::task::Task;
 
@@ -174,8 +174,8 @@ impl<'a> Condvar<'a> {
 /// ```
 pub struct Mutex<T> {
     lock: raw::Mutex,
-    failed: Unsafe<bool>,
-    data: Unsafe<T>,
+    failed: UnsafeCell<bool>,
+    data: UnsafeCell<T>,
 }
 
 /// An guard which is created by locking a mutex. Through this guard the
@@ -203,8 +203,8 @@ impl<T: Send> Mutex<T> {
     pub fn new_with_condvars(user_data: T, num_condvars: uint) -> Mutex<T> {
         Mutex {
             lock: raw::Mutex::new_with_condvars(num_condvars),
-            failed: Unsafe::new(false),
-            data: Unsafe::new(user_data),
+            failed: UnsafeCell::new(false),
+            data: UnsafeCell::new(user_data),
         }
     }
 
@@ -274,8 +274,8 @@ impl<'a, T: Send> DerefMut<T> for MutexGuard<'a, T> {
 /// ```
 pub struct RWLock<T> {
     lock: raw::RWLock,
-    failed: Unsafe<bool>,
-    data: Unsafe<T>,
+    failed: UnsafeCell<bool>,
+    data: UnsafeCell<T>,
 }
 
 /// A guard which is created by locking an rwlock in write mode. Through this
@@ -309,8 +309,8 @@ impl<T: Send + Share> RWLock<T> {
     pub fn new_with_condvars(user_data: T, num_condvars: uint) -> RWLock<T> {
         RWLock {
             lock: raw::RWLock::new_with_condvars(num_condvars),
-            failed: Unsafe::new(false),
-            data: Unsafe::new(user_data),
+            failed: UnsafeCell::new(false),
+            data: UnsafeCell::new(user_data),
         }
     }