Confusing MaybeUninit documentation #65216
Labels
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
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 text was updated successfully, but these errors were encountered: