diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 3db55b82fe8..3ed9c154e47 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1429,7 +1429,7 @@ fn from_iter>(iterable: I) -> Vec { vector } }; - vector.extend(iterable); + vector.extend_desugared(iterator); vector } } @@ -1466,9 +1466,14 @@ fn into_iter(mut self) -> slice::IterMut<'a, T> { #[unstable(feature = "collections", reason = "waiting on Extend stability")] impl Extend for Vec { + #[inline] fn extend>(&mut self, iterable: I) { - let mut iterator = iterable.into_iter(); + self.extend_desugared(iterable.into_iter()) + } +} +impl Vec { + fn extend_desugared>(&mut self, mut iterator: I) { // This function should be the moral equivalent of: // // for item in iterator {