Skip to content

Commit c3a1c02

Browse files
committed
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
2 parents 579c993 + 0ba5e74 commit c3a1c02

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

compiler/rustc_middle/src/ty/subst.rs

+12
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,10 @@ where
589589
fn next(&mut self) -> Option<Self::Item> {
590590
Some(EarlyBinder(self.it.next()?).subst(self.tcx, self.substs))
591591
}
592+
593+
fn size_hint(&self) -> (usize, Option<usize>) {
594+
self.it.size_hint()
595+
}
592596
}
593597

594598
impl<'tcx, I: IntoIterator> DoubleEndedIterator for SubstIter<'_, 'tcx, I>
@@ -631,6 +635,10 @@ where
631635
fn next(&mut self) -> Option<Self::Item> {
632636
Some(EarlyBinder(*self.it.next()?).subst(self.tcx, self.substs))
633637
}
638+
639+
fn size_hint(&self) -> (usize, Option<usize>) {
640+
self.it.size_hint()
641+
}
634642
}
635643

636644
impl<'tcx, I: IntoIterator> DoubleEndedIterator for SubstIterCopied<'_, 'tcx, I>
@@ -660,6 +668,10 @@ impl<T: Iterator> Iterator for EarlyBinderIter<T> {
660668
fn next(&mut self) -> Option<Self::Item> {
661669
self.t.next().map(|i| EarlyBinder(i))
662670
}
671+
672+
fn size_hint(&self) -> (usize, Option<usize>) {
673+
self.t.size_hint()
674+
}
663675
}
664676

665677
impl<'tcx, T: TypeFoldable<'tcx>> ty::EarlyBinder<T> {

0 commit comments

Comments
 (0)