You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tracking Issue for maybe_uninit_array_assume_init #80908
The documentation for this item suggests that it should be used with another unstable API, MaybeUninit::uninit_array. However that API is not contained under this feature flag, and furthermore I can't find a tracking issue for it. Should we use this issue to track that one as well?
Fwiw, this function is now used by hashbrown (nightly crate feature only, introduced in rust-lang/hashbrown#239). I'd love to see it stabilized soon! (Along with maybe_uninit_uninit_array.)
A possible alternative is to have a conversion method from [MaybeUninit<T>; N] to MaybeUninit<[T; N]> and then assume_init() the latter. Then a separate array_assume_init() function isn't needed.
Reacted by Marcel Hellwig, Joel Nordström, Vincent Esche, BuggStream, Muhammad Ragib Hasin and Benjamin Saunders
A possible alternative is to have a conversion method from [MaybeUninit<T>; N] to MaybeUninit<[T; N]> and then assume_init() the latter. Then a separate array_assume_init() function isn't needed.
That's a good idea! MaybeUninit::from(_).assume_init() is about the same length as MaybeUninit::array_assume_init(_) and allows for better integration with the other methods.
Would very much like some version of uninit_array and array_assume_init to be stable; right now there's not really a stable equivalent.
IMHO, we should at least collect the array-based issues into a single issue (likely this one) like what's already done with the slice methods in #63569.
I filed #96097 since MaybeUninit::uninit_array didn't have a tracking issue, and linked to this one. So, stuff that doesn't specifically apply to MaybeUninit::array_assume_init and concerns uninit arrays in general can probably go there instead of here.
Also created #96099 which adds constness to this method + links everything to the new issue so people are funnelled in the same place. If you think array_assume_init should still point here, I would voice so there.
Activity
joboet commentedon Jan 11, 2021
hellow554 commentedon Jan 11, 2021
joboet commentedon Jan 11, 2021
hellow554 commentedon Jan 11, 2021
Rollup merge of rust-lang#81412 - hyd-dev:array-assume-init-wrong-ass…
bstrie commentedon Jan 31, 2021
The documentation for this item suggests that it should be used with another unstable API,
MaybeUninit::uninit_array. However that API is not contained under this feature flag, and furthermore I can't find a tracking issue for it. Should we use this issue to track that one as well?cole-miller commentedon Feb 18, 2021
Fwiw, this function is now used by hashbrown (
nightlycrate feature only, introduced in rust-lang/hashbrown#239). I'd love to see it stabilized soon! (Along withmaybe_uninit_uninit_array.)the8472 commentedon Oct 27, 2021
A possible alternative is to have a conversion method from
[MaybeUninit<T>; N]toMaybeUninit<[T; N]>and thenassume_init()the latter. Then a separatearray_assume_init()function isn't needed.joboet commentedon Dec 12, 2021
That's a good idea!
MaybeUninit::from(_).assume_init()is about the same length asMaybeUninit::array_assume_init(_)and allows for better integration with the other methods.Kixunil commentedon Feb 2, 2022
Converting in the other direction could be useful too as well as between
MaybeUninit<[MaybeUninit<T>; N]>and the rest.clarfonthey commentedon Feb 18, 2022
Would very much like some version of
uninit_arrayandarray_assume_initto be stable; right now there's not really a stable equivalent.IMHO, we should at least collect the array-based issues into a single issue (likely this one) like what's already done with the slice methods in #63569.
Raekye commentedon Apr 14, 2022
MaybeUninit::assume_initis const as of 1.59, and I'd like to see this be const as wellOne issue with the conversion traits (
FromandInto) is that they can't be used in const contexts, so I'd like this function to exist as wellclarfonthey commentedon Apr 16, 2022
I filed #96097 since
MaybeUninit::uninit_arraydidn't have a tracking issue, and linked to this one. So, stuff that doesn't specifically apply toMaybeUninit::array_assume_initand concerns uninit arrays in general can probably go there instead of here.Also created #96099 which adds constness to this method + links everything to the new issue so people are funnelled in the same place. If you think
array_assume_initshould still point here, I would voice so there.joboet commentedon Apr 16, 2022
Thank you! I'll close this issue then. For future readers: please go to #96097 for further discussion of this feature.