Add comment.

This commit is contained in:
whitequark 2015-09-20 22:19:30 +03:00
parent 6beb4ba1aa
commit 77f5da77a9

View File

@ -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);