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:
bors 2022-11-26 14:59:30 +00:00
commit c3a1c023c0
1 changed files with 12 additions and 0 deletions

View File

@ -589,6 +589,10 @@ where
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 @@ where
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> {