diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index ddab16493f013..4110faa41b324 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1323,6 +1323,8 @@ impl Drop for Vec { // 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 takes linear time. if needs_drop::() { for x in self.iter_mut() { drop_in_place(x);