Skip to content

Commit 6ac64ab

Browse files
committed
Just delete the overrides now that they match the default implementations
1 parent 92e91f7 commit 6ac64ab

File tree

1 file changed

+1
-62
lines changed

1 file changed

+1
-62
lines changed

src/libcore/slice/mod.rs

+1-62
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::fmt;
2828
use crate::intrinsics::{assume, exact_div, unchecked_sub, is_aligned_and_not_null};
2929
use crate::isize;
3030
use crate::iter::*;
31-
use crate::ops::{FnMut, Try, self};
31+
use crate::ops::{FnMut, self};
3232
use crate::option::Option;
3333
use crate::option::Option::{None, Some};
3434
use crate::result::Result;
@@ -3180,33 +3180,6 @@ macro_rules! iterator {
31803180
self.next_back()
31813181
}
31823182

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-
32103183
#[inline]
32113184
#[rustc_inherit_overflow_checks]
32123185
fn position<P>(&mut self, mut predicate: P) -> Option<usize> where
@@ -3277,40 +3250,6 @@ macro_rules! iterator {
32773250
Some(next_back_unchecked!(self))
32783251
}
32793252
}
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-
}
33143253
}
33153254

33163255
#[stable(feature = "fused", since = "1.26.0")]

0 commit comments

Comments
 (0)