@@ -28,7 +28,7 @@ use crate::fmt;
28
28
use crate :: intrinsics:: { assume, exact_div, unchecked_sub, is_aligned_and_not_null} ;
29
29
use crate :: isize;
30
30
use crate :: iter:: * ;
31
- use crate :: ops:: { FnMut , Try , self } ;
31
+ use crate :: ops:: { FnMut , self } ;
32
32
use crate :: option:: Option ;
33
33
use crate :: option:: Option :: { None , Some } ;
34
34
use crate :: result:: Result ;
@@ -3180,33 +3180,6 @@ macro_rules! iterator {
3180
3180
self . next_back( )
3181
3181
}
3182
3182
3183
- #[ inline]
3184
- fn try_fold<B , F , R >( & mut self , init: B , mut f: F ) -> R where
3185
- Self : Sized , F : FnMut ( B , Self :: Item ) -> R , R : Try <Ok =B >
3186
- {
3187
- // This method historically was unrolled, for as of 2019-09 LLVM
3188
- // is not capable of unrolling or vectorizing multiple-exit loops.
3189
- // However, doing it always proved to often be a pessimization,
3190
- // especially when called with large closures, so it was removed.
3191
-
3192
- let mut accum = init;
3193
- while let Some ( x) = self . next( ) {
3194
- accum = f( accum, x) ?;
3195
- }
3196
- Try :: from_ok( accum)
3197
- }
3198
-
3199
- #[ inline]
3200
- fn fold<Acc , Fold >( mut self , init: Acc , mut f: Fold ) -> Acc
3201
- where Fold : FnMut ( Acc , Self :: Item ) -> Acc ,
3202
- {
3203
- let mut accum = init;
3204
- while let Some ( x) = self . next( ) {
3205
- accum = f( accum, x) ;
3206
- }
3207
- accum
3208
- }
3209
-
3210
3183
#[ inline]
3211
3184
#[ rustc_inherit_overflow_checks]
3212
3185
fn position<P >( & mut self , mut predicate: P ) -> Option <usize > where
@@ -3277,40 +3250,6 @@ macro_rules! iterator {
3277
3250
Some ( next_back_unchecked!( self ) )
3278
3251
}
3279
3252
}
3280
-
3281
- #[ inline]
3282
- fn try_rfold<B , F , R >( & mut self , init: B , mut f: F ) -> R where
3283
- Self : Sized , F : FnMut ( B , Self :: Item ) -> R , R : Try <Ok =B >
3284
- {
3285
- // manual unrolling is needed when there are conditional exits from the loop
3286
- let mut accum = init;
3287
- unsafe {
3288
- while len!( self ) >= 4 {
3289
- accum = f( accum, next_back_unchecked!( self ) ) ?;
3290
- accum = f( accum, next_back_unchecked!( self ) ) ?;
3291
- accum = f( accum, next_back_unchecked!( self ) ) ?;
3292
- accum = f( accum, next_back_unchecked!( self ) ) ?;
3293
- }
3294
- // inlining is_empty everywhere makes a huge performance difference
3295
- while !is_empty!( self ) {
3296
- accum = f( accum, next_back_unchecked!( self ) ) ?;
3297
- }
3298
- }
3299
- Try :: from_ok( accum)
3300
- }
3301
-
3302
- #[ inline]
3303
- fn rfold<Acc , Fold >( mut self , init: Acc , mut f: Fold ) -> Acc
3304
- where Fold : FnMut ( Acc , Self :: Item ) -> Acc ,
3305
- {
3306
- // Let LLVM unroll this, rather than using the default
3307
- // impl that would force the manual unrolling above
3308
- let mut accum = init;
3309
- while let Some ( x) = self . next_back( ) {
3310
- accum = f( accum, x) ;
3311
- }
3312
- accum
3313
- }
3314
3253
}
3315
3254
3316
3255
#[ stable( feature = "fused" , since = "1.26.0" ) ]
0 commit comments