auto merge of #18908 : tbu-/rust/pr_mapinplace_fixzerosized, r=alexcrichton

This commit is contained in:
bors 2014-11-21 09:01:50 +00:00
commit e583c4d24b

View File

@ -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
}
}