diff options
| author | Michael Goulet <michael@errs.io> | 2022-11-22 18:35:41 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-11-22 18:35:49 +0000 |
| commit | 0ba5e7416ffca2de7d328d0bcbd0321ab790edb3 (patch) | |
| tree | b150567c4a45347f6060bb484b743c9f8a047d3d | |
| parent | 66ccf36f161f67b121290e2af2517ead7e695d3b (diff) | |
| download | rust-0ba5e7416ffca2de7d328d0bcbd0321ab790edb3.tar.gz rust-0ba5e7416ffca2de7d328d0bcbd0321ab790edb3.zip | |
Add size hints to early binder iterator adapters
| -rw-r--r-- | compiler/rustc_middle/src/ty/subst.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/subst.rs b/compiler/rustc_middle/src/ty/subst.rs index c1cf7896db5..d8c1c63d7a3 100644 --- a/compiler/rustc_middle/src/ty/subst.rs +++ b/compiler/rustc_middle/src/ty/subst.rs @@ -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> { |
