File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 103
103
#![ feature( const_likely) ]
104
104
#![ feature( const_unreachable_unchecked) ]
105
105
#![ feature( const_maybe_uninit_assume_init) ]
106
+ #![ feature( const_maybe_uninit_as_ptr) ]
106
107
#![ feature( custom_inner_attributes) ]
107
108
#![ feature( decl_macro) ]
108
109
#![ feature( doc_cfg) ]
Original file line number Diff line number Diff line change @@ -668,13 +668,14 @@ impl<T> MaybeUninit<T> {
668
668
/// }
669
669
/// ```
670
670
#[ unstable( feature = "maybe_uninit_ref" , issue = "63568" ) ]
671
+ #[ rustc_const_unstable( feature = "const_maybe_uninit_assume_init" , issue = "none" ) ]
671
672
#[ inline( always) ]
672
- pub unsafe fn assume_init_ref ( & self ) -> & T {
673
+ pub const unsafe fn assume_init_ref ( & self ) -> & T {
673
674
// SAFETY: the caller must guarantee that `self` is initialized.
674
675
// This also means that `self` must be a `value` variant.
675
676
unsafe {
676
677
intrinsics:: assert_inhabited :: < T > ( ) ;
677
- & * self . value
678
+ & * self . as_ptr ( )
678
679
}
679
680
}
680
681
@@ -790,13 +791,14 @@ impl<T> MaybeUninit<T> {
790
791
// to uninitialized data (e.g., in `libcore/fmt/float.rs`). We should make
791
792
// a final decision about the rules before stabilization.
792
793
#[ unstable( feature = "maybe_uninit_ref" , issue = "63568" ) ]
794
+ #[ rustc_const_unstable( feature = "const_maybe_uninit_assume_init" , issue = "none" ) ]
793
795
#[ inline( always) ]
794
- pub unsafe fn assume_init_mut ( & mut self ) -> & mut T {
796
+ pub const unsafe fn assume_init_mut ( & mut self ) -> & mut T {
795
797
// SAFETY: the caller must guarantee that `self` is initialized.
796
798
// This also means that `self` must be a `value` variant.
797
799
unsafe {
798
800
intrinsics:: assert_inhabited :: < T > ( ) ;
799
- & mut * self . value
801
+ & mut * self . as_mut_ptr ( )
800
802
}
801
803
}
802
804
You can’t perform that action at this time.
0 commit comments