about summary refs log tree commit diff
diff options
context:
space:
mode:
authorpetrochenkov <vadim.petrochenkov@gmail.com>2015-05-30 12:15:19 +0300
committerpetrochenkov <vadim.petrochenkov@gmail.com>2015-05-30 12:15:19 +0300
commit019ab5dfec21ed296fa0eca6a96cf9f74f76a628 (patch)
tree448ecaa99d3f8198c9afb5123ddbda0516cf3f3c
parentefebe45cc0f3265ee8bb6396952e93a2004128c8 (diff)
downloadrust-019ab5dfec21ed296fa0eca6a96cf9f74f76a628.tar.gz
rust-019ab5dfec21ed296fa0eca6a96cf9f74f76a628.zip
Deprecate UnsafeCell::value
-rw-r--r--src/libcore/cell.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index 4c9f16fdaee..9c9cf14b393 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -641,6 +641,8 @@ pub struct UnsafeCell<T: ?Sized> {
     ///
     /// This field should not be accessed directly, it is made public for static
     /// initializers.
+    #[deprecated(since = "1.2.0", reason = "use `get` to access the wrapped \
+        value or `new` to initialize `UnsafeCell` in statics")]
     #[unstable(feature = "core")]
     pub value: T,
 }
@@ -664,6 +666,7 @@ impl<T> UnsafeCell<T> {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub const fn new(value: T) -> UnsafeCell<T> {
+        #![allow(deprecated)]
         UnsafeCell { value: value }
     }
 
@@ -685,7 +688,10 @@ impl<T> UnsafeCell<T> {
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub unsafe fn into_inner(self) -> T { self.value }
+    pub unsafe fn into_inner(self) -> T {
+        #![allow(deprecated)]
+        self.value
+    }
 }
 
 impl<T: ?Sized> UnsafeCell<T> {
@@ -705,6 +711,7 @@ impl<T: ?Sized> UnsafeCell<T> {
     pub fn get(&self) -> *mut T {
         // FIXME(#23542) Replace with type ascription.
         #![allow(trivial_casts)]
+        #![allow(deprecated)]
         &self.value as *const T as *mut T
     }
 }