Doc clarification for MaybeUninit::zeroed()
#111608
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
E-help-wanted
Call for participation: Help is requested to fix this issue.
Location
https://doc.rust-lang.org/std/mem/union.MaybeUninit.html#method.zeroed
Summary
While perhaps implied by the terminology of "memory being filled with 0 bytes", it would be great to explicitly state whether or not padding bytes are included.
For me it's a bit ambiguous because both
std::mem::zeroed
andstd::mem::MaybeUninit
are parametrized byT
. Hence, neither really exposes a concept of "raw" bytes to the user, but just the Rust type. Yet if I compare the above documentation tostd::mem::zeroed
it states, among other things:So there padding bytes are explicitly excluded.
It's particularly confusing, because
std::mem::zeroed
states:Should we make it more explicit that
std::mem::MaybeUninit::zeroed
also zeroes out padding bytes? (assuming that's the behavior we want; it seems to be the behavior we currently have)The text was updated successfully, but these errors were encountered: