File tree 1 file changed +8
-1
lines changed
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> {
795
795
///
796
796
/// This field should not be accessed directly, it is made public for static
797
797
/// initializers.
798
+ #[ deprecated( since = "1.2.0" , reason = "use `get` to access the wrapped \
799
+ value or `new` to initialize `UnsafeCell` in statics") ]
798
800
#[ unstable( feature = "core" ) ]
799
801
pub value : T ,
800
802
}
@@ -818,6 +820,7 @@ impl<T> UnsafeCell<T> {
818
820
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
819
821
#[ inline]
820
822
pub const fn new ( value : T ) -> UnsafeCell < T > {
823
+ #![ allow( deprecated) ]
821
824
UnsafeCell { value : value }
822
825
}
823
826
@@ -839,7 +842,10 @@ impl<T> UnsafeCell<T> {
839
842
/// ```
840
843
#[ inline]
841
844
#[ 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
+ }
843
849
}
844
850
845
851
impl < T : ?Sized > UnsafeCell < T > {
@@ -859,6 +865,7 @@ impl<T: ?Sized> UnsafeCell<T> {
859
865
pub fn get ( & self ) -> * mut T {
860
866
// FIXME(#23542) Replace with type ascription.
861
867
#![ allow( trivial_casts) ]
868
+ #![ allow( deprecated) ]
862
869
& self . value as * const T as * mut T
863
870
}
864
871
}
You can’t perform that action at this time.
0 commit comments