1
Fork 0

fix dangling reference in Vec::append

This commit is contained in:
Ralf Jung 2019-05-23 16:30:16 +02:00
parent f688ba6089
commit f44b264447
2 changed files with 4 additions and 3 deletions

View file

@ -1094,7 +1094,7 @@ impl<T> Vec<T> {
let count = (*other).len();
self.reserve(count);
let len = self.len();
ptr::copy_nonoverlapping(other as *const T, self.get_unchecked_mut(len), count);
ptr::copy_nonoverlapping(other as *const T, self.as_mut_ptr().add(len), count);
self.len += count;
}