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/autoderef.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'crates/hir_ty/src/autoderef.rs') diff --git a/crates/hir_ty/src/autoderef.rs b/crates/hir_ty/src/autoderef.rs index dc5fc759a..5e3c018a8 100644 --- a/crates/hir_ty/src/autoderef.rs +++ b/crates/hir_ty/src/autoderef.rs @@ -131,7 +131,7 @@ fn deref_by_trait( // new variables in that case for i in 1..vars.0.binders.len(&Interner) { - if vars.0.value[i - 1].interned(&Interner) + if vars.0.value.at(&Interner, i - 1).assert_ty_ref(&Interner).interned(&Interner) != &TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, i - 1)) { warn!("complex solution for derefing {:?}: {:?}, ignoring", ty.goal, solution); @@ -139,7 +139,12 @@ fn deref_by_trait( } } Some(Canonical { - value: vars.0.value[vars.0.value.len() - 1].clone(), + value: vars + .0 + .value + .at(&Interner, vars.0.value.len(&Interner) - 1) + .assert_ty_ref(&Interner) + .clone(), binders: vars.0.binders.clone(), }) } -- cgit v1.2.3