Open
Description
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<T> MaybeUninit<T> {
pub const fn uninit_array<const N: usize>() -> [Self; N];
pub const fn array_assume_init<const N: usize>(array: [Self; N]) -> [T; N];
}
impl<T, const N: usize> MaybeUninit<[T; N]> {
pub const fn transpose(self) -> [MaybeUninit<T>; N];
}
impl<T, const N: usize> [MaybeUninit<T>; N] {
pub const fn transpose(self) -> MaybeUninit<[T; N]>;
}
Steps / History
- Add
MaybeUninit
methodsuninit_array
,slice_get_ref
,slice_get_mut
#65580 - Add
MaybeUninit
methodarray_assume_init
#80600 - Make const: MaybeUninit array cleanup #96099
- Add MaybeUninit array transpose impls #102023
- 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]
? - 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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment