@@ -350,13 +350,13 @@ impl<T> MaybeUninit<T> {
350350 /// let mut buf: [MaybeUninit<u8>; 32] = MaybeUninit::uninit_array();
351351 /// let data = read(&mut buf);
352352 /// ```
353- #[ unstable( feature = "maybe_uninit_uninit_array" , issue = "none " ) ]
354- #[ rustc_const_unstable( feature = "maybe_uninit_uninit_array " , issue = "none " ) ]
353+ #[ unstable( feature = "maybe_uninit_uninit_array" , issue = "96097 " ) ]
354+ #[ rustc_const_unstable( feature = "const_maybe_uninit_uninit_array " , issue = "96097 " ) ]
355355 #[ must_use]
356356 #[ inline( always) ]
357- pub const fn uninit_array < const LEN : usize > ( ) -> [ Self ; LEN ] {
357+ pub const fn uninit_array < const N : usize > ( ) -> [ Self ; N ] {
358358 // SAFETY: An uninitialized `[MaybeUninit<_>; LEN]` is valid.
359- unsafe { MaybeUninit :: < [ MaybeUninit < T > ; LEN ] > :: uninit ( ) . assume_init ( ) }
359+ unsafe { MaybeUninit :: < [ MaybeUninit < T > ; N ] > :: uninit ( ) . assume_init ( ) }
360360 }
361361
362362 /// Creates a new `MaybeUninit<T>` in an uninitialized state, with the memory being
@@ -942,19 +942,24 @@ impl<T> MaybeUninit<T> {
942942 ///
943943 /// assert_eq!(array, [0, 1, 2]);
944944 /// ```
945- #[ unstable( feature = "maybe_uninit_array_assume_init" , issue = "80908" ) ]
945+ #[ unstable( feature = "maybe_uninit_array_assume_init" , issue = "96097" ) ]
946+ #[ rustc_const_unstable( feature = "const_maybe_uninit_array_assume_init" , issue = "96097" ) ]
946947 #[ inline( always) ]
947948 #[ track_caller]
948- pub unsafe fn array_assume_init < const N : usize > ( array : [ Self ; N ] ) -> [ T ; N ] {
949+ pub const unsafe fn array_assume_init < const N : usize > ( array : [ Self ; N ] ) -> [ T ; N ] {
949950 // SAFETY:
950951 // * The caller guarantees that all elements of the array are initialized
951952 // * `MaybeUninit<T>` and T are guaranteed to have the same layout
952953 // * `MaybeUninit` does not drop, so there are no double-frees
953954 // And thus the conversion is safe
954- unsafe {
955+ let ret = unsafe {
955956 intrinsics:: assert_inhabited :: < [ T ; N ] > ( ) ;
956957 ( & array as * const _ as * const [ T ; N ] ) . read ( )
957- }
958+ } ;
959+
960+ // FIXME: required to avoid `~const Destruct` bound
961+ super :: forget ( array) ;
962+ ret
958963 }
959964
960965 /// Assuming all the elements are initialized, get a slice to them.
0 commit comments