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 @@ -641,6 +641,8 @@ pub struct UnsafeCell<T: ?Sized> {
641
641
///
642
642
/// This field should not be accessed directly, it is made public for static
643
643
/// initializers.
644
+ #[ deprecated( since = "1.2.0" , reason = "use `get` to access the wrapped \
645
+ value or `new` to initialize `UnsafeCell` in statics") ]
644
646
#[ unstable( feature = "core" ) ]
645
647
pub value : T ,
646
648
}
@@ -664,6 +666,7 @@ impl<T> UnsafeCell<T> {
664
666
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
665
667
#[ inline]
666
668
pub const fn new ( value : T ) -> UnsafeCell < T > {
669
+ #![ allow( deprecated) ]
667
670
UnsafeCell { value : value }
668
671
}
669
672
@@ -685,7 +688,10 @@ impl<T> UnsafeCell<T> {
685
688
/// ```
686
689
#[ inline]
687
690
#[ 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
+ }
689
695
}
690
696
691
697
impl < T : ?Sized > UnsafeCell < T > {
@@ -705,6 +711,7 @@ impl<T: ?Sized> UnsafeCell<T> {
705
711
pub fn get ( & self ) -> * mut T {
706
712
// FIXME(#23542) Replace with type ascription.
707
713
#![ allow( trivial_casts) ]
714
+ #![ allow( deprecated) ]
708
715
& self . value as * const T as * mut T
709
716
}
710
717
}
You can’t perform that action at this time.
0 commit comments