Skip to content

Commit

Permalink
MaybeUninit::zeroed: mention that padding is not zeroed
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Sep 11, 2024
1 parent a9fb00b commit d4ac759
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/core/src/mem/maybe_uninit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ impl<T> MaybeUninit<T> {
/// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not
/// be null.
///
/// Note that if `T` has padding bytes, those bytes are *not* preserved when the
/// `MaybeUninit<T>` value is returned from this function, so those bytes will *not* be zeroed.
///
/// Note that dropping a `MaybeUninit<T>` will never call `T`'s drop code.
/// It is your responsibility to make sure `T` gets dropped if it got initialized.
///
Expand Down

0 comments on commit d4ac759

Please sign in to comment.