diff options
| author | Ralf Jung <post@ralfj.de> | 2019-08-05 20:13:59 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-08-05 20:13:59 +0200 |
| commit | e1875742d024c9ac52889d26881ca39a2a14cd8e (patch) | |
| tree | 68b3f36d6195e94c87ab21ef438dcaff4950a26c /src/libcore/mem | |
| parent | 4be067558962c004b638e4c6f162d50f7c0c98b6 (diff) | |
assume_init: warn about valid != safe
Diffstat (limited to 'src/libcore/mem')
| -rw-r--r-- | src/libcore/mem/maybe_uninit.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs index 64fdf504369..20367f724b6 100644 --- a/src/libcore/mem/maybe_uninit.rs +++ b/src/libcore/mem/maybe_uninit.rs @@ -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: |
