Skip to content

Commit e583c4d

Browse files
committed
auto merge of #18908 : tbu-/rust/pr_mapinplace_fixzerosized, r=alexcrichton
2 parents 2fcbf90 + 59b3c83 commit e583c4d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libcollections/vec.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,10 @@ impl<T> Vec<T> {
16471647
// Create a `Vec` from our `PartialVecZeroSized` and make sure the
16481648
// destructor of the latter will not run. None of this can panic.
16491649
let mut result = Vec::new();
1650-
unsafe { result.set_len(pv.num_u); }
1650+
unsafe {
1651+
result.set_len(pv.num_u);
1652+
mem::forget(pv);
1653+
}
16511654
result
16521655
}
16531656
}

0 commit comments

Comments
 (0)