diff options
| author | bors <bors@rust-lang.org> | 2022-11-26 14:59:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-26 14:59:30 +0000 |
| commit | c3a1c023c0784ffbcf4dd57cf4618d208bccae69 (patch) | |
| tree | 44ca0a7c04407cb0f46798de2b8d870b74cd0bd2 | |
| parent | 579c993b35a02dc439b74bba18b0a14f77911c95 (diff) | |
| parent | 0ba5e7416ffca2de7d328d0bcbd0321ab790edb3 (diff) | |
| download | rust-c3a1c023c0784ffbcf4dd57cf4618d208bccae69.tar.gz rust-c3a1c023c0784ffbcf4dd57cf4618d208bccae69.zip | |
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
| -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> { |
