Skip to content

Commit

Permalink
Add comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Sep 20, 2015
1 parent 6beb4ba commit 77f5da7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,8 @@ impl<T> Drop for Vec<T> {
// don't need unsafe_no_drop_flag shenanigans anymore.
if self.buf.unsafe_no_drop_flag_needs_drop() {
unsafe {
// The branch on needs_drop() is an -O1 performance optimization.
// Without the branch, dropping Vec<u8> takes linear time.
if needs_drop::<T>() {
for x in self.iter_mut() {
drop_in_place(x);
Expand Down

0 comments on commit 77f5da7

Please sign in to comment.