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
This ACP breaks off a small piece of #122 that wasn't discussed in depth.
Problem statement
The MaybeUninit::slice_as_(mut_)ptr methods force you to elide bounds checks to go from MaybeUninit<T> to T.
fnslice_as_ptr(this:&[MaybeUninit<T>]) -> *constT
Motivating examples or use cases
There is evidence of unnecessary bounds elision occurring in the stdlib: notice the places that were switched to using array indexing in rust-lang/rust@f2e9b40.
Solution sketch
Remove MaybeUninit::slice_as_(mut_)ptr.
Optionally, I'd like to add methods for *const/*mut MaybeUninit<T> -> *const/*mut T. This restores the type safety provided by slice_as_ptr and enables improved type safety in other cases where one has a raw pointer to a MaybeUninit and wishes to get at the wrapped type. Without these methods, you'd just have to do the cast manually which isn't the end of the world.