We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6beb4ba commit 77f5da7Copy full SHA for 77f5da7
src/libcollections/vec.rs
@@ -1323,6 +1323,8 @@ impl<T> Drop for Vec<T> {
1323
// don't need unsafe_no_drop_flag shenanigans anymore.
1324
if self.buf.unsafe_no_drop_flag_needs_drop() {
1325
unsafe {
1326
+ // The branch on needs_drop() is an -O1 performance optimization.
1327
+ // Without the branch, dropping Vec<u8> takes linear time.
1328
if needs_drop::<T>() {
1329
for x in self.iter_mut() {
1330
drop_in_place(x);
0 commit comments