From e480d81988fc0c0e4f80f1c54058b95b9aaf1ebf Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Thu, 1 Apr 2021 21:04:02 +0200 Subject: Introduce `GenericArg` like in Chalk Plus some more adaptations to Substitution. Lots of `assert_ty_ref` that we should revisit when introducing lifetime/const parameters. --- crates/hir_ty/src/method_resolution.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/hir_ty/src/method_resolution.rs') diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index bf7d5eded..054896475 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -720,7 +720,7 @@ pub(crate) fn inherent_impl_substs( chalk_ir::VariableKind::Ty(chalk_ir::TyVariableKind::General), UniverseIndex::ROOT, )) - .take(vars.len()), + .take(vars.len(&Interner)), ); let tys = Canonical { binders: CanonicalVarKinds::from_iter(&Interner, kinds), @@ -732,7 +732,8 @@ pub(crate) fn inherent_impl_substs( // Unknown. I think this can only really happen if self_ty contained // Unknown, and in that case we want the result to contain Unknown in those // places again. - substs.map(|s| fallback_bound_vars(s.suffix(vars.len()), self_ty.binders.len(&Interner))) + substs + .map(|s| fallback_bound_vars(s.suffix(vars.len(&Interner)), self_ty.binders.len(&Interner))) } /// This replaces any 'free' Bound vars in `s` (i.e. those with indices past @@ -821,7 +822,7 @@ fn generic_implements_goal( chalk_ir::VariableKind::Ty(chalk_ir::TyVariableKind::General), UniverseIndex::ROOT, )) - .take(substs.len() - 1), + .take(substs.len(&Interner) - 1), ); let trait_ref = TraitRef { trait_id: to_chalk_trait_id(trait_), substitution: substs }; let obligation = trait_ref.cast(&Interner); -- cgit v1.2.3