Skip to content

Commit

Permalink
Fix Vec::map_in_place not doing what is written in the comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tbu- committed Nov 12, 2014
1 parent e1149f0 commit 59b3c83
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libcollections/vec.rs
Expand Up @@ -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
}
}
Expand Down

5 comments on commit 59b3c83

@bors
Copy link
Contributor

@bors bors commented on 59b3c83 Nov 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at tbu-@59b3c83

@bors
Copy link
Contributor

@bors bors commented on 59b3c83 Nov 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging tbu-/rust/pr_mapinplace_fixzerosized = 59b3c83 into auto

@bors
Copy link
Contributor

@bors bors commented on 59b3c83 Nov 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbu-/rust/pr_mapinplace_fixzerosized = 59b3c83 merged ok, testing candidate = e583c4d

@bors
Copy link
Contributor

@bors bors commented on 59b3c83 Nov 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 59b3c83 Nov 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = e583c4d

Please sign in to comment.