Skip to content

Commit a55bf34

Browse files
committed
MaybeUninit::zeroed: mention that padding is not zeroed
1 parent 95de48b commit a55bf34

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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)