about summary refs log tree commit diff
path: root/src/liballoc/vec.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-07-26 21:08:38 +0000
committerbors <bors@rust-lang.org>2017-07-26 21:08:38 +0000
commit599be0d18f4c6ddf36366d2a5a2ca6dc65886896 (patch)
treeb45698b672fa56662213f15740197fc32db9252f /src/liballoc/vec.rs
parentd02fb3bcf42c05740a47fdfb0d9e5dd8ec24ff37 (diff)
parent959ebd6785b48360ac48e334a18b3abe66beef17 (diff)
downloadrust-599be0d18f4c6ddf36366d2a5a2ca6dc65886896.tar.gz
rust-599be0d18f4c6ddf36366d2a5a2ca6dc65886896.zip
Auto merge of #43487 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 10 pull requests

- Successful merges: #42959, #43447, #43455, #43456, #43458, #43462, #43463, #43465, #43471, #43480
- Failed merges:
Diffstat (limited to 'src/liballoc/vec.rs')
-rw-r--r--src/liballoc/vec.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 780a51aec3b..da47ca50983 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -1126,7 +1126,7 @@ impl<T> Vec<T> {
                 tail_start: end,
                 tail_len: len - end,
                 iter: range_slice.iter(),
-                vec: Shared::new(self as *mut _),
+                vec: Shared::from(self),
             }
         }
     }
@@ -1727,7 +1727,7 @@ impl<T> IntoIterator for Vec<T> {
             let cap = self.buf.cap();
             mem::forget(self);
             IntoIter {
-                buf: Shared::new(begin),
+                buf: Shared::new_unchecked(begin),
                 cap: cap,
                 ptr: begin,
                 end: end,
@@ -1962,6 +1962,12 @@ impl<T> Vec<T> {
 
 }
 
+/// Extend implementation that copies elements out of references before pushing them onto the Vec.
+///
+/// This implementation is specialized for slice iterators, where it uses [`copy_from_slice`] to
+/// append the entire slice at once.
+///
+/// [`copy_from_slice`]: ../../std/primitive.slice.html#method.copy_from_slice
 #[stable(feature = "extend_ref", since = "1.2.0")]
 impl<'a, T: 'a + Copy> Extend<&'a T> for Vec<T> {
     fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {