mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Rollup merge of #130214 - RalfJung:zeroed, r=Mark-Simulacrum
MaybeUninit::zeroed: mention that padding is not zeroed That should clarify cases like [this](https://github.com/rust-lang/rust/pull/129778#issuecomment-2342542847).
This commit is contained in:
commit
0648987532
@ -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.
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user