Rollup merge of #74602 - poliorcetics:maybe-uninit-zeroed-doc-clarification, r=jyn514

Clarify the doc for MaybeUninit::zeroed on incorrect use

Fixes #74343.

@rustbot modify labels: C-enhancement, T-doc
This commit is contained in:
Manish Goregaokar 2020-08-01 17:42:11 -07:00 committed by GitHub
commit 39436ebe72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -336,8 +336,8 @@ 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: calling `x.zeroed().assume_init()`
/// when `0` is not a valid bit-pattern for the type:
///
/// ```rust,no_run
/// use std::mem::MaybeUninit;