Skip to content

Commit

Permalink
restore Vec::extend specialization for vec::IntoIter sources that
Browse files Browse the repository at this point in the history
was lost during refactoring
  • Loading branch information
the8472 committed Sep 3, 2020
1 parent 07a8c1b commit 631543d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions library/alloc/src/vec.rs
Expand Up @@ -2297,6 +2297,15 @@ where
}
}

impl<T> SpecExtend<T, IntoIter<T>> for Vec<T> {
fn spec_extend(&mut self, mut iterator: IntoIter<T>) {
unsafe {
self.append_elements(iterator.as_slice() as _);
}
iterator.ptr = iterator.end;
}
}

impl<'a, T: 'a, I> SpecExtend<&'a T, I> for Vec<T>
where
I: Iterator<Item = &'a T>,
Expand Down

0 comments on commit 631543d

Please sign in to comment.