about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-02-29 20:23:10 +0000
committerbors <bors@rust-lang.org>2020-02-29 20:23:10 +0000
commitd3c79346a3e7ddbb5fb417810f226ac5a9209007 (patch)
tree3a06e2bd6ae80a87209ec3792d7979e00a2fe3fd /src/liballoc
parent4f0edbdfe5f111c43a5e06f68186b95141d1f6c8 (diff)
parentad200af5c4cb4296b7dfcfab68fd8f1573f149e4 (diff)
downloadrust-d3c79346a3e7ddbb5fb417810f226ac5a9209007.tar.gz
rust-d3c79346a3e7ddbb5fb417810f226ac5a9209007.zip
Auto merge of #69590 - Dylan-DPC:rollup-i3z0sic, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #69504 (Use assert_ne in hash tests)
 - #69571 (remove unneeded .as_ref() calls.)
 - #69572 (use .iter() instead of .into_iter() on references)
 - #69581 (fix aliasing violation in align_to_mut)
 - #69582 (improve transmute and Vec::from_raw_parts docs)
 - #69584 (Correct comment to match behavior)
 - #69587 (rustc_parse: Tweak the function parameter name check)

Failed merges:

r? @ghost
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/vec.rs6
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
     ///