1
Fork 0

Rollup merge of #108350 - compiler-errors:assoc-type-bound-dogfooding, r=oli-obk

Use associated type bounds in some places in the compiler

Use associated type bounds for some nested `impl Trait<Assoc = impl Trait2>` cases. I'm generally keen to introduce new lang features that are more mature into the compiler, but maybe let's see what others think?

Side-note: I was surprised that the only use-cases of nested impl trait in the compiler are just iterator related?!
This commit is contained in:
Matthias Krüger 2023-02-23 06:18:07 +01:00 committed by GitHub
commit d6077f895a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 22 additions and 41 deletions

View file

@ -239,7 +239,7 @@ pub fn predicate_for_trait_def<'tcx>(
cause: ObligationCause<'tcx>,
trait_def_id: DefId,
recursion_depth: usize,
params: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
params: impl IntoIterator<Item: Into<GenericArg<'tcx>>>,
) -> PredicateObligation<'tcx> {
let trait_ref = tcx.mk_trait_ref(trait_def_id, params);
predicate_for_trait_ref(tcx, cause, param_env, trait_ref, recursion_depth)