Skip to content

Commit c13d666

Browse files
authored
Unrolled build for rust-lang#130214
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)).
2 parents 4f1be92 + d4ac759 commit c13d666

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

library/core/src/mem/maybe_uninit.rs

+3
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ impl<T> MaybeUninit<T> {
351351
/// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not
352352
/// be null.
353353
///
354+
/// Note that if `T` has padding bytes, those bytes are *not* preserved when the
355+
/// `MaybeUninit<T>` value is returned from this function, so those bytes will *not* be zeroed.
356+
///
354357
/// Note that dropping a `MaybeUninit<T>` will never call `T`'s drop code.
355358
/// It is your responsibility to make sure `T` gets dropped if it got initialized.
356359
///

0 commit comments

Comments
 (0)