Skip to content

Commit b7a6c4a

Browse files
committed
Perf Experiment: Wait, what if I just skip the trait alias
1 parent 3d96601 commit b7a6c4a

34 files changed

+110
-131
lines changed

library/alloc/src/collections/vec_deque/iter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use core::fmt;
22
use core::iter::{FusedIterator, TrustedLen, TrustedRandomAccess};
3-
use core::ops::TryWhereOutputEquals;
3+
use core::ops::Try;
44

55
use super::{count, wrap_index, RingSlices};
66

@@ -66,7 +66,7 @@ impl<'a, T> Iterator for Iter<'a, T> {
6666
where
6767
Self: Sized,
6868
F: FnMut(B, Self::Item) -> R,
69-
R: TryWhereOutputEquals<B>,
69+
R: Try<Output = B>,
7070
{
7171
let (mut iter, final_res);
7272
if self.tail <= self.head {
@@ -140,7 +140,7 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
140140
where
141141
Self: Sized,
142142
F: FnMut(B, Self::Item) -> R,
143-
R: TryWhereOutputEquals<B>,
143+
R: Try<Output = B>,
144144
{
145145
let (mut iter, final_res);
146146
if self.tail <= self.head {

library/alloc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
#![feature(alloc_layout_extra)]
142142
#![feature(trusted_random_access)]
143143
#![feature(try_trait)]
144-
#![feature(try_trait_transition)]
144+
#![feature(try_trait_v2)]
145145
#![feature(min_type_alias_impl_trait)]
146146
#![feature(associated_type_bounds)]
147147
#![feature(slice_group_by)]

library/core/src/iter/adapters/chain.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::iter::{DoubleEndedIterator, FusedIterator, Iterator, TrustedLen};
2-
use crate::ops::TryWhereOutputEquals;
2+
use crate::ops::Try;
33

44
/// An iterator that links two iterators together, in a chain.
55
///
@@ -98,7 +98,7 @@ where
9898
where
9999
Self: Sized,
100100
F: FnMut(Acc, Self::Item) -> R,
101-
R: TryWhereOutputEquals<Acc>,
101+
R: Try<Output = Acc>,
102102
{
103103
if let Some(ref mut a) = self.a {
104104
acc = a.try_fold(acc, &mut f)?;
@@ -281,7 +281,7 @@ where
281281
where
282282
Self: Sized,
283283
F: FnMut(Acc, Self::Item) -> R,
284-
R: TryWhereOutputEquals<Acc>,
284+
R: Try<Output = Acc>,
285285
{
286286
if let Some(ref mut b) = self.b {
287287
acc = b.try_rfold(acc, &mut f)?;

library/core/src/iter/adapters/cloned.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::iter::adapters::{zip::try_get_unchecked, TrustedRandomAccess};
22
use crate::iter::{FusedIterator, TrustedLen};
3-
use crate::ops::TryWhereOutputEquals;
3+
use crate::ops::Try;
44

55
/// An iterator that clones the elements of an underlying iterator.
66
///
@@ -46,7 +46,7 @@ where
4646
where
4747
Self: Sized,
4848
F: FnMut(B, Self::Item) -> R,
49-
R: TryWhereOutputEquals<B>,
49+
R: Try<Output = B>,
5050
{
5151
self.it.try_fold(init, clone_try_fold(f))
5252
}
@@ -82,7 +82,7 @@ where
8282
where
8383
Self: Sized,
8484
F: FnMut(B, Self::Item) -> R,
85-
R: TryWhereOutputEquals<B>,
85+
R: Try<Output = B>,
8686
{
8787
self.it.try_rfold(init, clone_try_fold(f))
8888
}

library/core/src/iter/adapters/copied.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::iter::adapters::{zip::try_get_unchecked, TrustedRandomAccess};
22
use crate::iter::{FusedIterator, TrustedLen};
3-
use crate::ops::TryWhereOutputEquals;
3+
use crate::ops::Try;
44

55
/// An iterator that copies the elements of an underlying iterator.
66
///
@@ -50,7 +50,7 @@ where
5050
where
5151
Self: Sized,
5252
F: FnMut(B, Self::Item) -> R,
53-
R: TryWhereOutputEquals<B>,
53+
R: Try<Output = B>,
5454
{
5555
self.it.try_fold(init, copy_try_fold(f))
5656
}
@@ -98,7 +98,7 @@ where
9898
where
9999
Self: Sized,
100100
F: FnMut(B, Self::Item) -> R,
101-
R: TryWhereOutputEquals<B>,
101+
R: Try<Output = B>,
102102
{
103103
self.it.try_rfold(init, copy_try_fold(f))
104104
}

library/core/src/iter/adapters/cycle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{iter::FusedIterator, ops::TryWhereOutputEquals};
1+
use crate::{iter::FusedIterator, ops::Try};
22

33
/// An iterator that repeats endlessly.
44
///
@@ -53,7 +53,7 @@ where
5353
fn try_fold<Acc, F, R>(&mut self, mut acc: Acc, mut f: F) -> R
5454
where
5555
F: FnMut(Acc, Self::Item) -> R,
56-
R: TryWhereOutputEquals<Acc>,
56+
R: Try<Output = Acc>,
5757
{
5858
// fully iterate the current iterator. this is necessary because
5959
// `self.iter` may be empty even when `self.orig` isn't

library/core/src/iter/adapters/enumerate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::iter::adapters::{zip::try_get_unchecked, SourceIter, TrustedRandomAccess};
22
use crate::iter::{FusedIterator, InPlaceIterable, TrustedLen};
3-
use crate::ops::TryWhereOutputEquals;
3+
use crate::ops::Try;
44

55
/// An iterator that yields the current count and the element during iteration.
66
///
@@ -71,7 +71,7 @@ where
7171
where
7272
Self: Sized,
7373
Fold: FnMut(Acc, Self::Item) -> R,
74-
R: TryWhereOutputEquals<Acc>,
74+
R: Try<Output = Acc>,
7575
{
7676
#[inline]
7777
fn enumerate<'a, T, Acc, R>(
@@ -150,7 +150,7 @@ where
150150
where
151151
Self: Sized,
152152
Fold: FnMut(Acc, Self::Item) -> R,
153-
R: TryWhereOutputEquals<Acc>,
153+
R: Try<Output = Acc>,
154154
{
155155
// Can safely add and subtract the count, as `ExactSizeIterator` promises
156156
// that the number of elements fits into a `usize`.

library/core/src/iter/adapters/filter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::fmt;
22
use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable};
3-
use crate::ops::TryWhereOutputEquals;
3+
use crate::ops::Try;
44

55
/// An iterator that filters the elements of `iter` with `predicate`.
66
///
@@ -37,7 +37,7 @@ fn filter_fold<T, Acc>(
3737
move |acc, item| if predicate(&item) { fold(acc, item) } else { acc }
3838
}
3939

40-
fn filter_try_fold<'a, T, Acc, R: TryWhereOutputEquals<Acc>>(
40+
fn filter_try_fold<'a, T, Acc, R: Try<Output = Acc>>(
4141
predicate: &'a mut impl FnMut(&T) -> bool,
4242
mut fold: impl FnMut(Acc, T) -> R + 'a,
4343
) -> impl FnMut(Acc, T) -> R + 'a {
@@ -88,7 +88,7 @@ where
8888
where
8989
Self: Sized,
9090
Fold: FnMut(Acc, Self::Item) -> R,
91-
R: TryWhereOutputEquals<Acc>,
91+
R: Try<Output = Acc>,
9292
{
9393
self.iter.try_fold(init, filter_try_fold(&mut self.predicate, fold))
9494
}
@@ -117,7 +117,7 @@ where
117117
where
118118
Self: Sized,
119119
Fold: FnMut(Acc, Self::Item) -> R,
120-
R: TryWhereOutputEquals<Acc>,
120+
R: Try<Output = Acc>,
121121
{
122122
self.iter.try_rfold(init, filter_try_fold(&mut self.predicate, fold))
123123
}

library/core/src/iter/adapters/filter_map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::fmt;
22
use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable};
3-
use crate::ops::{ControlFlow, TryWhereOutputEquals};
3+
use crate::ops::{ControlFlow, Try};
44

55
/// An iterator that uses `f` to both filter and map elements from `iter`.
66
///
@@ -39,7 +39,7 @@ fn filter_map_fold<T, B, Acc>(
3939
}
4040
}
4141

42-
fn filter_map_try_fold<'a, T, B, Acc, R: TryWhereOutputEquals<Acc>>(
42+
fn filter_map_try_fold<'a, T, B, Acc, R: Try<Output = Acc>>(
4343
f: &'a mut impl FnMut(T) -> Option<B>,
4444
mut fold: impl FnMut(Acc, B) -> R + 'a,
4545
) -> impl FnMut(Acc, T) -> R + 'a {
@@ -72,7 +72,7 @@ where
7272
where
7373
Self: Sized,
7474
Fold: FnMut(Acc, Self::Item) -> R,
75-
R: TryWhereOutputEquals<Acc>,
75+
R: Try<Output = Acc>,
7676
{
7777
self.iter.try_fold(init, filter_map_try_fold(&mut self.f, fold))
7878
}
@@ -111,7 +111,7 @@ where
111111
where
112112
Self: Sized,
113113
Fold: FnMut(Acc, Self::Item) -> R,
114-
R: TryWhereOutputEquals<Acc>,
114+
R: Try<Output = Acc>,
115115
{
116116
self.iter.try_rfold(init, filter_map_try_fold(&mut self.f, fold))
117117
}

library/core/src/iter/adapters/flatten.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::fmt;
22
use crate::iter::{DoubleEndedIterator, Fuse, FusedIterator, Iterator, Map};
3-
use crate::ops::TryWhereOutputEquals;
3+
use crate::ops::Try;
44

55
/// An iterator that maps each element to an iterator, and yields the elements
66
/// of the produced iterators.
@@ -61,7 +61,7 @@ where
6161
where
6262
Self: Sized,
6363
Fold: FnMut(Acc, Self::Item) -> R,
64-
R: TryWhereOutputEquals<Acc>,
64+
R: Try<Output = Acc>,
6565
{
6666
self.inner.try_fold(init, fold)
6767
}
@@ -91,7 +91,7 @@ where
9191
where
9292
Self: Sized,
9393
Fold: FnMut(Acc, Self::Item) -> R,
94-
R: TryWhereOutputEquals<Acc>,
94+
R: Try<Output = Acc>,
9595
{
9696
self.inner.try_rfold(init, fold)
9797
}
@@ -178,7 +178,7 @@ where
178178
where
179179
Self: Sized,
180180
Fold: FnMut(Acc, Self::Item) -> R,
181-
R: TryWhereOutputEquals<Acc>,
181+
R: Try<Output = Acc>,
182182
{
183183
self.inner.try_fold(init, fold)
184184
}
@@ -208,7 +208,7 @@ where
208208
where
209209
Self: Sized,
210210
Fold: FnMut(Acc, Self::Item) -> R,
211-
R: TryWhereOutputEquals<Acc>,
211+
R: Try<Output = Acc>,
212212
{
213213
self.inner.try_rfold(init, fold)
214214
}
@@ -293,10 +293,10 @@ where
293293
where
294294
Self: Sized,
295295
Fold: FnMut(Acc, Self::Item) -> R,
296-
R: TryWhereOutputEquals<Acc>,
296+
R: Try<Output = Acc>,
297297
{
298298
#[inline]
299-
fn flatten<'a, T: IntoIterator, Acc, R: TryWhereOutputEquals<Acc>>(
299+
fn flatten<'a, T: IntoIterator, Acc, R: Try<Output = Acc>>(
300300
frontiter: &'a mut Option<T::IntoIter>,
301301
fold: &'a mut impl FnMut(Acc, T::Item) -> R,
302302
) -> impl FnMut(Acc, T) -> R + 'a {
@@ -382,10 +382,10 @@ where
382382
where
383383
Self: Sized,
384384
Fold: FnMut(Acc, Self::Item) -> R,
385-
R: TryWhereOutputEquals<Acc>,
385+
R: Try<Output = Acc>,
386386
{
387387
#[inline]
388-
fn flatten<'a, T: IntoIterator, Acc, R: TryWhereOutputEquals<Acc>>(
388+
fn flatten<'a, T: IntoIterator, Acc, R: Try<Output = Acc>>(
389389
backiter: &'a mut Option<T::IntoIter>,
390390
fold: &'a mut impl FnMut(Acc, T::Item) -> R,
391391
) -> impl FnMut(Acc, T) -> R + 'a

0 commit comments

Comments
 (0)