Add comment.
This commit is contained in:
parent
6beb4ba1aa
commit
77f5da77a9
1 changed files with 2 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue