-
Notifications
You must be signed in to change notification settings - Fork 307
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
Change uninitialized to return an array of MaybeUninit #685
Comments
Internally I'd kind of just like a |
I'm not sure the recipe in the title of this issue is what we should do - there might be better ways to do it, for example to provide raw pointer traversals |
Can we explain why To me it looks like it can't be UB, on its own, but further method calls would be needed. Maybe this comment can back me up rust-lang/rust-clippy#4483 (comment) Edit: I have a tentative conclusion, |
Internal implementation of this is added in #797, that's a start. |
The
.uninitialized()
method onArrayBase
has some issues. For example,Array1::<bool>::uninitialized(2)
is undefined behavior.Rust 1.36 added
std::mem::MaybeUninit
for safer handling of uninitialized data. We should replace the existing.uninitialized()
method onArrayBase
with one that returns an array ofMaybeUninit
instances. We then need to add the necessary methods to cleanly work with arrays like this (e.g. an array-level equivalent ofassume_init
).The text was updated successfully, but these errors were encountered: