diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-02-29 18:54:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-29 18:54:04 +0100 |
| commit | 015bb74650f80de4411b8d12d897fad9ed35a915 (patch) | |
| tree | 487b5cd77158c4d80e355943a858923451b4d496 /src/liballoc | |
| parent | 02381db8e0cd4412bec4254fd78e140e7b036fa7 (diff) | |
| parent | b6e847cc983c3e4d4ab96b026cea6743db00a133 (diff) | |
| download | rust-015bb74650f80de4411b8d12d897fad9ed35a915.tar.gz rust-015bb74650f80de4411b8d12d897fad9ed35a915.zip | |
Rollup merge of #69582 - RalfJung:vec-parts, r=Centril
improve transmute and Vec::from_raw_parts docs I think this fixes https://github.com/rust-lang/rust/issues/64073. @Shnatsel please let me know if this is less confusing. :)
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/vec.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 29987ac44e6..fc50d06b33c 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -404,7 +404,10 @@ impl<T> Vec<T> { /// /// * `ptr` needs to have been previously allocated via [`String`]/`Vec<T>` /// (at least, it's highly likely to be incorrect if it wasn't). - /// * `ptr`'s `T` needs to have the same size and alignment as it was allocated with. + /// * `T` needs to have the same size and alignment as what `ptr` was allocated with. + /// (`T` having a less strict alignment is not sufficient, the alignment really + /// needs to be equal to satsify the [`dealloc`] requirement that memory must be + /// allocated and deallocated with the same layout.) /// * `length` needs to be less than or equal to `capacity`. /// * `capacity` needs to be the capacity that the pointer was allocated with. /// @@ -423,6 +426,7 @@ impl<T> Vec<T> { /// function. /// /// [`String`]: ../../std/string/struct.String.html + /// [`dealloc`]: ../../alloc/alloc/trait.GlobalAlloc.html#tymethod.dealloc /// /// # Examples /// |
