Clarify the doc for MaybeUninit::zeroed on incorrect use

This commit is contained in:
Alexis Bourget 2020-07-21 22:44:25 +02:00
parent 2c28244cf0
commit 36bb5e8a42

View File

@ -336,8 +336,9 @@ impl<T> MaybeUninit<T> {
/// assert_eq!(x, (0, false));
/// ```
///
/// *Incorrect* usage of this function: initializing a struct with zero, where some fields
/// cannot hold 0 as a valid value.
/// *Incorrect* usage of this function: assuming zero filled memory is initialized,
/// where some fields cannot hold 0 as a valid value, without overwriting with a
/// valid bit-pattern.
///
/// ```rust,no_run
/// use std::mem::MaybeUninit;