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 @@ -795,6 +795,8 @@ pub struct UnsafeCell<T: ?Sized> {
795795 ///
796796 /// This field should not be accessed directly, it is made public for static
797797 /// initializers.
798+ #[ deprecated( since = "1.2.0" , reason = "use `get` to access the wrapped \
799+ value or `new` to initialize `UnsafeCell` in statics") ]
798800 #[ unstable( feature = "core" ) ]
799801 pub value : T ,
800802}
@@ -818,6 +820,7 @@ impl<T> UnsafeCell<T> {
818820 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
819821 #[ inline]
820822 pub const fn new ( value : T ) -> UnsafeCell < T > {
823+ #![ allow( deprecated) ]
821824 UnsafeCell { value : value }
822825 }
823826
@@ -839,7 +842,10 @@ impl<T> UnsafeCell<T> {
839842 /// ```
840843 #[ inline]
841844 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
842- pub unsafe fn into_inner ( self ) -> T { self . value }
845+ pub unsafe fn into_inner ( self ) -> T {
846+ #![ allow( deprecated) ]
847+ self . value
848+ }
843849}
844850
845851impl < T : ?Sized > UnsafeCell < T > {
@@ -859,6 +865,7 @@ impl<T: ?Sized> UnsafeCell<T> {
859865 pub fn get ( & self ) -> * mut T {
860866 // FIXME(#23542) Replace with type ascription.
861867 #![ allow( trivial_casts) ]
868+ #![ allow( deprecated) ]
862869 & self . value as * const T as * mut T
863870 }
864871}
You can’t perform that action at this time.
0 commit comments