File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ use borrow::ToOwned;
66
66
use core:: cmp:: Ordering ;
67
67
use core:: fmt;
68
68
use core:: hash:: { self , Hash } ;
69
- use core:: intrinsics:: { arith_offset, assume, needs_drop } ;
69
+ use core:: intrinsics:: { arith_offset, assume} ;
70
70
use core:: iter:: FromIterator ;
71
71
use core:: mem;
72
72
use core:: ops:: { Index , IndexMut } ;
@@ -1471,13 +1471,8 @@ impl<T> Drop for Vec<T> {
1471
1471
fn drop ( & mut self ) {
1472
1472
if self . buf . unsafe_no_drop_flag_needs_drop ( ) {
1473
1473
unsafe {
1474
- // The branch on needs_drop() is an -O1 performance optimization.
1475
- // Without the branch, dropping Vec<u8> takes linear time.
1476
- if needs_drop :: < T > ( ) {
1477
- for x in self . iter_mut ( ) {
1478
- ptr:: drop_in_place ( x) ;
1479
- }
1480
- }
1474
+ // use drop for [T]
1475
+ ptr:: drop_in_place ( & mut self [ ..] ) ;
1481
1476
}
1482
1477
}
1483
1478
// RawVec handles deallocation
You can’t perform that action at this time.
0 commit comments