@@ -26,17 +26,17 @@ pub struct ExtractIf<
2626 F ,
2727 #[ unstable( feature = "allocator_api" , issue = "32838" ) ] A : Allocator = Global ,
2828> {
29- pub ( super ) vec : & ' a mut Vec < T , A > ,
29+ vec : & ' a mut Vec < T , A > ,
3030 /// The index of the item that will be inspected by the next call to `next`.
31- pub ( super ) idx : usize ,
31+ idx : usize ,
3232 /// Elements at and beyond this point will be retained. Must be equal or smaller than `old_len`.
33- pub ( super ) end : usize ,
33+ end : usize ,
3434 /// The number of items that have been drained (removed) thus far.
35- pub ( super ) del : usize ,
35+ del : usize ,
3636 /// The original length of `vec` prior to draining.
37- pub ( super ) old_len : usize ,
37+ old_len : usize ,
3838 /// The filter test predicate.
39- pub ( super ) pred : F ,
39+ pred : F ,
4040}
4141
4242impl < ' a , T , F , A : Allocator > ExtractIf < ' a , T , F , A > {
@@ -100,12 +100,6 @@ impl<T, F, A: Allocator> Drop for ExtractIf<'_, T, F, A> {
100100 fn drop ( & mut self ) {
101101 unsafe {
102102 if self . idx < self . old_len && self . del > 0 {
103- // This is a pretty messed up state, and there isn't really an
104- // obviously right thing to do. We don't want to keep trying
105- // to execute `pred`, so we just backshift all the unprocessed
106- // elements and tell the vec that they still exist. The backshift
107- // is required to prevent a double-drop of the last successfully
108- // drained item prior to a panic in the predicate.
109103 let ptr = self . vec . as_mut_ptr ( ) ;
110104 let src = ptr. add ( self . idx ) ;
111105 let dst = src. sub ( self . del ) ;
0 commit comments