We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e6abf1 commit 567cd52Copy full SHA for 567cd52
library/alloc/src/vec.rs
@@ -2412,12 +2412,13 @@ impl<T> SpecExtend<T, IntoIter<T>> for Vec<T> {
2412
{
2413
// Safety: we just checked that IntoIter has sufficient capacity to prepend our elements.
2414
// Prepending will then fill the uninitialized prefix.
2415
- *self = unsafe {
+ let v = unsafe {
2416
let mut v = iterator.into_vec_with_uninit_prefix(self.len() as isize);
2417
ptr::copy_nonoverlapping(self.as_ptr(), v.as_mut_ptr(), self.len);
2418
self.set_len(0);
2419
v
2420
};
2421
+ *self = v;
2422
return;
2423
}
2424
iterator.move_into(self);
0 commit comments