@@ -373,8 +373,9 @@ impl<T> MaybeUninit<T> {
373
373
/// skip running the destructor. For your convenience, this also returns a mutable
374
374
/// reference to the (now safely initialized) contents of `self`.
375
375
#[ unstable( feature = "maybe_uninit_extra" , issue = "63567" ) ]
376
+ #[ rustc_const_unstable( feature = "maybe_uninit_extra" , issue = "63567" ) ]
376
377
#[ inline( always) ]
377
- pub fn write ( & mut self , val : T ) -> & mut T {
378
+ pub const fn write ( & mut self , val : T ) -> & mut T {
378
379
* self = MaybeUninit :: new ( val) ;
379
380
// SAFETY: We just initialized this value.
380
381
unsafe { self . assume_init_mut ( ) }
@@ -846,15 +847,17 @@ impl<T> MaybeUninit<T> {
846
847
847
848
/// Gets a pointer to the first element of the array.
848
849
#[ unstable( feature = "maybe_uninit_slice" , issue = "63569" ) ]
850
+ #[ rustc_const_unstable( feature = "maybe_uninit_slice" , issue = "63569" ) ]
849
851
#[ inline( always) ]
850
- pub fn slice_as_ptr ( this : & [ MaybeUninit < T > ] ) -> * const T {
852
+ pub const fn slice_as_ptr ( this : & [ MaybeUninit < T > ] ) -> * const T {
851
853
this. as_ptr ( ) as * const T
852
854
}
853
855
854
856
/// Gets a mutable pointer to the first element of the array.
855
857
#[ unstable( feature = "maybe_uninit_slice" , issue = "63569" ) ]
858
+ #[ rustc_const_unstable( feature = "maybe_uninit_slice" , issue = "63569" ) ]
856
859
#[ inline( always) ]
857
- pub fn slice_as_mut_ptr ( this : & mut [ MaybeUninit < T > ] ) -> * mut T {
860
+ pub const fn slice_as_mut_ptr ( this : & mut [ MaybeUninit < T > ] ) -> * mut T {
858
861
this. as_mut_ptr ( ) as * mut T
859
862
}
860
863
}
0 commit comments