diff options
| author | bors <bors@rust-lang.org> | 2015-06-02 23:23:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-06-02 23:23:32 +0000 |
| commit | e8af4752ce15d5c755cae61b7fc1c0c67b577414 (patch) | |
| tree | b3d30a6adbf2e76d494e766a4181d53cdc1413eb | |
| parent | dc1e79b3c215ac71285f468ed4e7715528e7e9f4 (diff) | |
| parent | 019ab5dfec21ed296fa0eca6a96cf9f74f76a628 (diff) | |
| download | rust-e8af4752ce15d5c755cae61b7fc1c0c67b577414.tar.gz rust-e8af4752ce15d5c755cae61b7fc1c0c67b577414.zip | |
Auto merge of #25867 - petrochenkov:ucellv, r=alexcrichton
Now when const functions are implemented and used, the `value` field of `UnsafeCell` can be made deprecated (and then private as intended).
| -rw-r--r-- | src/libcore/cell.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index c5d08c3dd20..d867453008a 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -795,6 +795,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, } @@ -818,6 +820,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 } } @@ -839,7 +842,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> { @@ -859,6 +865,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 } } |
