Tracking Issue for MaybeUninit methods for arrays · Issue #96097 · rust-lang/rust (original) (raw)
This is a meta-tracking issue for multiple APIs that are linked across multiple issues. Right now it only includes two methods, but since there seems to be a desire to add more, this issue can be used as a placeholder for those discussions until those methods are added.
Public API
impl MaybeUninit { pub const fn array_assume_init(array: [Self; N]) -> [T; N]; }
impl<T, const N: usize> MaybeUninit<[T; N]> { pub const fn transpose(self) -> [MaybeUninit; N]; }
impl<T, const N: usize> [MaybeUninit; N] { pub const fn transpose(self) -> MaybeUninit<[T; N]>; }
Steps / History
- Add MaybeUninit methods uninit_array, slice_get_ref, slice_get_mut #65580
- Add MaybeUninit method array_assume_init #80600
- Make const: MaybeUninit array cleanup #96099
- Add MaybeUninit array transpose impls #102023
- Replace uses of MaybeUninit::uninit_array() with inline const blocks. #125082
- Final comment period (FCP)
- Stabilization PR
Relevant Links
- Old tracking issue for array_assume_init: Tracking Issue for maybe_uninit_array_assume_init #80908
Unresolved Questions
- Should
MaybeUninit::uninit_array::<LEN>()
be stabilised if it can be replaced by[const { MaybeUninit::uninit() }; LEN]
?- No,
fcp close
to remove that: Tracking Issue for MaybeUninit methods for arrays #96097 (comment)
- No,
- What other APIs should be added for arrays?
- Is
array_assume_init
the right pattern, or should we convert from[MaybeUninit<T>, N]
back toMaybeUninit<[T; N]>
first?