Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Vec::insert_slice_clone: fix unsound Vec after T::clone panic
Browse files Browse the repository at this point in the history
  • Loading branch information
qwertz19281 committed Feb 4, 2021
1 parent f4eae5b commit 20cb73d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/imp/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ impl<T> VecExt<T> for Vec<T> {
}

unsafe {
self.set_len(0);
{
let mut p = self.as_mut_ptr().add(index);
ptr::copy(p, p.add(slen), vlen - index);
Expand Down

0 comments on commit 20cb73d

Please sign in to comment.