]> git.lizzy.rs Git - rust.git/commitdiff
Add comment.
authorwhitequark <whitequark@whitequark.org>
Sun, 20 Sep 2015 19:19:30 +0000 (22:19 +0300)
committerwhitequark <whitequark@whitequark.org>
Sun, 20 Sep 2015 19:23:35 +0000 (22:23 +0300)
src/libcollections/vec.rs

index ddab16493f01367995250d392c2dda32e6d6aded..4110faa41b32473520319d94b84118dbfb228267 100644 (file)
@@ -1323,6 +1323,8 @@ fn drop(&mut self) {
         // 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);