Auto merge of #104731 - compiler-errors:early-binder-iter-size-hint, r=cjgillot
Add size hints to early binder iterator adapters probably doesn't do anything, but definitely doesn't hurt
This commit is contained in:
commit
c3a1c023c0
@ -589,6 +589,10 @@ impl<'tcx, I: IntoIterator> Iterator for SubstIter<'_, 'tcx, I>
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
Some(EarlyBinder(self.it.next()?).subst(self.tcx, self.substs))
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.it.size_hint()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, I: IntoIterator> DoubleEndedIterator for SubstIter<'_, 'tcx, I>
|
||||
@ -631,6 +635,10 @@ impl<'tcx, I: IntoIterator> Iterator for SubstIterCopied<'_, 'tcx, I>
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
Some(EarlyBinder(*self.it.next()?).subst(self.tcx, self.substs))
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.it.size_hint()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, I: IntoIterator> DoubleEndedIterator for SubstIterCopied<'_, 'tcx, I>
|
||||
@ -660,6 +668,10 @@ impl<T: Iterator> Iterator for EarlyBinderIter<T> {
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
self.t.next().map(|i| EarlyBinder(i))
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.t.size_hint()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T: TypeFoldable<'tcx>> ty::EarlyBinder<T> {
|
||||
|
Loading…
Reference in New Issue
Block a user