auto merge of #18908 : tbu-/rust/pr_mapinplace_fixzerosized, r=alexcrichton
This commit is contained in:
commit
e583c4d24b
@ -1647,7 +1647,10 @@ pub fn map_in_place<U>(self, f: |T| -> U) -> Vec<U> {
|
||||
// Create a `Vec` from our `PartialVecZeroSized` and make sure the
|
||||
// destructor of the latter will not run. None of this can panic.
|
||||
let mut result = Vec::new();
|
||||
unsafe { result.set_len(pv.num_u); }
|
||||
unsafe {
|
||||
result.set_len(pv.num_u);
|
||||
mem::forget(pv);
|
||||
}
|
||||
result
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user