diff options
| author | Ralf Jung <post@ralfj.de> | 2019-08-06 09:47:42 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-08-06 09:47:42 +0200 |
| commit | 1b9eb4ac4cb5ecc5a16a1ed781a88af4c65bfc2f (patch) | |
| tree | e2e93987ef76c6a81ea6c94f764c9a33bcd54ad7 | |
| parent | e1875742d024c9ac52889d26881ca39a2a14cd8e (diff) | |
| download | rust-1b9eb4ac4cb5ecc5a16a1ed781a88af4c65bfc2f.tar.gz rust-1b9eb4ac4cb5ecc5a16a1ed781a88af4c65bfc2f.zip | |
be clear that 1-init Vec being valid (but not safe) is not a stable guarantee
| -rw-r--r-- | src/libcore/mem/maybe_uninit.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs index 20367f724b6..43c4b491ac8 100644 --- a/src/libcore/mem/maybe_uninit.rs +++ b/src/libcore/mem/maybe_uninit.rs @@ -51,7 +51,8 @@ use crate::mem::ManuallyDrop; /// /// 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 considered initialized (under the current implementation, this does not constitute +/// a stable guarantee) 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). @@ -404,7 +405,8 @@ impl<T> MaybeUninit<T> { /// /// 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 considered initialized (under the current implementation, this does not constitute + /// a stable guarantee) 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). |
