assume_init: warn about valid != safe

This commit is contained in:
Ralf Jung 2019-08-05 20:13:59 +02:00
parent 4be0675589
commit e1875742d0

View file

@ -402,6 +402,13 @@ impl<T> MaybeUninit<T> {
///
/// [inv]: #initialization-invariant
///
/// On top of that, remember that most types have additional invariants beyond merely
/// being considered initialized at the type level. For example, a `1`-initialized [`Vec<T>`]
/// is considered initialized because the only requirement the compiler knows about it
/// is that the data pointer must be non-null. Creating such a `Vec<T>` does not cause
/// *immediate* undefined behavior, but will cause undefined behavior with most
/// safe operations (including dropping it).
///
/// # Examples
///
/// Correct usage of this method: