Skip to content

Commit

Permalink
Unrolled build for rust-lang#130214
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#130214 - RalfJung:zeroed, r=Mark-Simulacrum

MaybeUninit::zeroed: mention that padding is not zeroed

That should clarify cases like [this](rust-lang#129778 (comment)).
  • Loading branch information
rust-timer authored Sep 15, 2024
2 parents 4f1be92 + d4ac759 commit c13d666
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 c13d666

Please sign in to comment.