diff options
| author | Michael Goulet <michael@errs.io> | 2023-07-17 17:49:47 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-07-17 21:04:12 +0000 |
| commit | 05f6890b3e8d35981e043f24e7a8c02810a2db59 (patch) | |
| tree | 555bbc5ca51205882ac6c866549ae6d09da19037 /compiler/rustc_middle/src/ty | |
| parent | 4eaad89dce57da09cebbf651e9ac3bd3292b4725 (diff) | |
| download | rust-05f6890b3e8d35981e043f24e7a8c02810a2db59.tar.gz rust-05f6890b3e8d35981e043f24e7a8c02810a2db59.zip | |
Rename arg_iter to iter_instantiated
Diffstat (limited to 'compiler/rustc_middle/src/ty')
| -rw-r--r-- | compiler/rustc_middle/src/ty/generic_args.rs | 30 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/generics.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 2 |
3 files changed, 19 insertions, 15 deletions
diff --git a/compiler/rustc_middle/src/ty/generic_args.rs b/compiler/rustc_middle/src/ty/generic_args.rs index 12af8456494..97dab5cb47e 100644 --- a/compiler/rustc_middle/src/ty/generic_args.rs +++ b/compiler/rustc_middle/src/ty/generic_args.rs @@ -610,8 +610,12 @@ impl<'tcx, 's, I: IntoIterator> EarlyBinder<I> where I::Item: TypeFoldable<TyCtxt<'tcx>>, { - pub fn arg_iter(self, tcx: TyCtxt<'tcx>, args: &'s [GenericArg<'tcx>]) -> ArgIter<'s, 'tcx, I> { - ArgIter { it: self.value.into_iter(), tcx, args } + pub fn iter_instantiated( + self, + tcx: TyCtxt<'tcx>, + args: &'s [GenericArg<'tcx>], + ) -> IterInstantiated<'s, 'tcx, I> { + IterInstantiated { it: self.value.into_iter(), tcx, args } } /// Similar to [`instantiate_identity`](EarlyBinder::instantiate_identity), @@ -621,13 +625,13 @@ where } } -pub struct ArgIter<'s, 'tcx, I: IntoIterator> { +pub struct IterInstantiated<'s, 'tcx, I: IntoIterator> { it: I::IntoIter, tcx: TyCtxt<'tcx>, args: &'s [GenericArg<'tcx>], } -impl<'tcx, I: IntoIterator> Iterator for ArgIter<'_, 'tcx, I> +impl<'tcx, I: IntoIterator> Iterator for IterInstantiated<'_, 'tcx, I> where I::Item: TypeFoldable<TyCtxt<'tcx>>, { @@ -642,7 +646,7 @@ where } } -impl<'tcx, I: IntoIterator> DoubleEndedIterator for ArgIter<'_, 'tcx, I> +impl<'tcx, I: IntoIterator> DoubleEndedIterator for IterInstantiated<'_, 'tcx, I> where I::IntoIter: DoubleEndedIterator, I::Item: TypeFoldable<TyCtxt<'tcx>>, @@ -652,7 +656,7 @@ where } } -impl<'tcx, I: IntoIterator> ExactSizeIterator for ArgIter<'_, 'tcx, I> +impl<'tcx, I: IntoIterator> ExactSizeIterator for IterInstantiated<'_, 'tcx, I> where I::IntoIter: ExactSizeIterator, I::Item: TypeFoldable<TyCtxt<'tcx>>, @@ -664,12 +668,12 @@ where I::Item: Deref, <I::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>, { - pub fn arg_iter_copied( + pub fn iter_instantiated_copied( self, tcx: TyCtxt<'tcx>, args: &'s [GenericArg<'tcx>], - ) -> ArgIterCopied<'s, 'tcx, I> { - ArgIterCopied { it: self.value.into_iter(), tcx, args } + ) -> IterInstantiatedCopied<'s, 'tcx, I> { + IterInstantiatedCopied { it: self.value.into_iter(), tcx, args } } /// Similar to [`instantiate_identity`](EarlyBinder::instantiate_identity), @@ -681,13 +685,13 @@ where } } -pub struct ArgIterCopied<'a, 'tcx, I: IntoIterator> { +pub struct IterInstantiatedCopied<'a, 'tcx, I: IntoIterator> { it: I::IntoIter, tcx: TyCtxt<'tcx>, args: &'a [GenericArg<'tcx>], } -impl<'tcx, I: IntoIterator> Iterator for ArgIterCopied<'_, 'tcx, I> +impl<'tcx, I: IntoIterator> Iterator for IterInstantiatedCopied<'_, 'tcx, I> where I::Item: Deref, <I::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>, @@ -703,7 +707,7 @@ where } } -impl<'tcx, I: IntoIterator> DoubleEndedIterator for ArgIterCopied<'_, 'tcx, I> +impl<'tcx, I: IntoIterator> DoubleEndedIterator for IterInstantiatedCopied<'_, 'tcx, I> where I::IntoIter: DoubleEndedIterator, I::Item: Deref, @@ -716,7 +720,7 @@ where } } -impl<'tcx, I: IntoIterator> ExactSizeIterator for ArgIterCopied<'_, 'tcx, I> +impl<'tcx, I: IntoIterator> ExactSizeIterator for IterInstantiatedCopied<'_, 'tcx, I> where I::IntoIter: ExactSizeIterator, I::Item: Deref, diff --git a/compiler/rustc_middle/src/ty/generics.rs b/compiler/rustc_middle/src/ty/generics.rs index 338590717d0..70a35f137d8 100644 --- a/compiler/rustc_middle/src/ty/generics.rs +++ b/compiler/rustc_middle/src/ty/generics.rs @@ -347,7 +347,7 @@ impl<'tcx> GenericPredicates<'tcx> { tcx: TyCtxt<'tcx>, args: GenericArgsRef<'tcx>, ) -> impl Iterator<Item = (Clause<'tcx>, Span)> + DoubleEndedIterator + ExactSizeIterator { - EarlyBinder::bind(self.predicates).arg_iter_copied(tcx, args) + EarlyBinder::bind(self.predicates).iter_instantiated_copied(tcx, args) } #[instrument(level = "debug", skip(self, tcx))] diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 3591acdea56..70eb389b406 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -928,7 +928,7 @@ pub trait PrettyPrinter<'tcx>: let mut is_sized = false; let mut lifetimes = SmallVec::<[ty::Region<'tcx>; 1]>::new(); - for (predicate, _) in bounds.arg_iter_copied(tcx, args) { + for (predicate, _) in bounds.iter_instantiated_copied(tcx, args) { let bound_predicate = predicate.kind(); match bound_predicate.skip_binder() { |
