File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -641,6 +641,8 @@ pub struct UnsafeCell<T: ?Sized> {
641641 ///
642642 /// This field should not be accessed directly, it is made public for static
643643 /// initializers.
644+ #[ deprecated( since = "1.2.0" , reason = "use `get` to access the wrapped \
645+ value or `new` to initialize `UnsafeCell` in statics") ]
644646 #[ unstable( feature = "core" ) ]
645647 pub value : T ,
646648}
@@ -664,6 +666,7 @@ impl<T> UnsafeCell<T> {
664666 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
665667 #[ inline]
666668 pub const fn new ( value : T ) -> UnsafeCell < T > {
669+ #![ allow( deprecated) ]
667670 UnsafeCell { value : value }
668671 }
669672
@@ -685,7 +688,10 @@ impl<T> UnsafeCell<T> {
685688 /// ```
686689 #[ inline]
687690 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
688- pub unsafe fn into_inner ( self ) -> T { self . value }
691+ pub unsafe fn into_inner ( self ) -> T {
692+ #![ allow( deprecated) ]
693+ self . value
694+ }
689695}
690696
691697impl < T : ?Sized > UnsafeCell < T > {
@@ -705,6 +711,7 @@ impl<T: ?Sized> UnsafeCell<T> {
705711 pub fn get ( & self ) -> * mut T {
706712 // FIXME(#23542) Replace with type ascription.
707713 #![ allow( trivial_casts) ]
714+ #![ allow( deprecated) ]
708715 & self . value as * const T as * mut T
709716 }
710717}
You can’t perform that action at this time.
0 commit comments