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

Commit 20cb73d

Browse files
committed
Vec::insert_slice_clone: fix unsound Vec after T::clone panic
1 parent f4eae5b commit 20cb73d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/imp/vec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ impl<T> VecExt<T> for Vec<T> {
8181
}
8282

8383
unsafe {
84+
self.set_len(0);
8485
{
8586
let mut p = self.as_mut_ptr().add(index);
8687
ptr::copy(p, p.add(slen), vlen - index);

0 commit comments

Comments
 (0)