fix dangling reference in Vec::append
This commit is contained in:
parent
f688ba6089
commit
f44b264447
2 changed files with 4 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue