-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking Issue for maybe_uninit_array_assume_init #80908
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…ertion, r=m-ou-se Fix assertion in `MaybeUninit::array_assume_init()` for zero-length arrays That assertion has a false positive ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=63922b8c897b04112adcdf346deb1d0e)): ```rust #![feature(maybe_uninit_array_assume_init)] use std::mem::MaybeUninit; enum Uninhabited {} fn main() { unsafe { // thread 'main' panicked at 'attempted to instantiate uninhabited type `Uninhabited`' MaybeUninit::<Uninhabited>::array_assume_init([]); } } ``` *Previously reported in rust-lang#80600 (comment) This PR makes it ignore zero-length arrays. cc rust-lang#80908
The documentation for this item suggests that it should be used with another unstable API, |
Fwiw, this function is now used by hashbrown ( |
A possible alternative is to have a conversion method from |
That's a good idea! |
Converting in the other direction could be useful too as well as between |
Would very much like some version of 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. |
One issue with the conversion traits ( |
I filed #96097 since 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 |
Thank you! I'll close this issue then. For future readers: please go to #96097 for further discussion of this feature. |
Feature gate:
#![feature(maybe_uninit_array_assume_init)]
This is a tracking issue for
MaybeUninit::array_assume_init
.Public API
Steps / History
MaybeUninit
methodarray_assume_init
#80600Unresolved Questions
[MaybeUninit<T>; N]
toMaybeUninit<[T; N]>
(see comment).The text was updated successfully, but these errors were encountered: