Skip to content

Commit

Permalink
Auto merge of #104731 - compiler-errors:early-binder-iter-size-hint, …
Browse files Browse the repository at this point in the history
…r=cjgillot

Add size hints to early binder iterator adapters

probably doesn't do anything, but definitely doesn't hurt
  • Loading branch information
bors committed Nov 26, 2022
2 parents 579c993 + 0ba5e74 commit c3a1c02
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions compiler/rustc_middle/src/ty/subst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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> {
Expand Down

0 comments on commit c3a1c02

Please sign in to comment.