diff options
| author | Tobias Bucher <tobiasbucher5991@gmail.com> | 2014-11-12 23:34:32 +0100 |
|---|---|---|
| committer | Tobias Bucher <tobiasbucher5991@gmail.com> | 2014-11-12 23:34:32 +0100 |
| commit | 59b3c83a819567a1ca8b7c8535dad5bf73c855b1 (patch) | |
| tree | 2b2d9986342d94d0657b80b1c9a28e6cf45758c6 | |
| parent | e1149f0223e28b320a3f4d66981ce09607fb6535 (diff) | |
| download | rust-59b3c83a819567a1ca8b7c8535dad5bf73c855b1.tar.gz rust-59b3c83a819567a1ca8b7c8535dad5bf73c855b1.zip | |
Fix `Vec::map_in_place` not doing what is written in the comment
| -rw-r--r-- | src/libcollections/vec.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 0e3799ed9ac..4a341898606 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1661,7 +1661,10 @@ impl<T> Vec<T> { // 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 } } |
