The as_ptr method on a MaybeUninit<T> perhaps could use some better wording, or at least an example.
The docs say: "Writing to memory that this pointer (non-transitively) points to is undefined behavior (except inside an UnsafeCell)."
Its unclear whether that means &MaybeUninit<UnsafeCell<T>> -> *const UnsafeCell<T> -> *mut T is okey, or that &UnsafeCell<MaybeUninit<T>> -> *mut MaybeUninit<T> -> *mut T is okey, if the resulting mutable pointer is written to.
Perhaps adding a little example of which of the two is okey, (or perhaps both) would help.
The as_ptr method on a
MaybeUninit<T>perhaps could use some better wording, or at least an example.The docs say: "Writing to memory that this pointer (non-transitively) points to is undefined behavior (except inside an UnsafeCell)."
Its unclear whether that means
&MaybeUninit<UnsafeCell<T>> -> *const UnsafeCell<T> -> *mut Tis okey, or that&UnsafeCell<MaybeUninit<T>> -> *mut MaybeUninit<T> -> *mut Tis okey, if the resulting mutable pointer is written to.Perhaps adding a little example of which of the two is okey, (or perhaps both) would help.