diff options
author | Florian Diebold <[email protected]> | 2021-04-01 20:04:02 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-03 10:17:13 +0100 |
commit | e480d81988fc0c0e4f80f1c54058b95b9aaf1ebf (patch) | |
tree | 079dabc4e0de72e30d2bd04bd50427ff6950b348 /crates/hir_ty/src/autoderef.rs | |
parent | 327f3a0a3017e047be58b8312f8bf3ac690db3fd (diff) |
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.
Diffstat (limited to 'crates/hir_ty/src/autoderef.rs')
-rw-r--r-- | crates/hir_ty/src/autoderef.rs | 9 |
1 files changed, 7 insertions, 2 deletions
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( | |||
131 | // new variables in that case | 131 | // new variables in that case |
132 | 132 | ||
133 | for i in 1..vars.0.binders.len(&Interner) { | 133 | for i in 1..vars.0.binders.len(&Interner) { |
134 | if vars.0.value[i - 1].interned(&Interner) | 134 | if vars.0.value.at(&Interner, i - 1).assert_ty_ref(&Interner).interned(&Interner) |
135 | != &TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, i - 1)) | 135 | != &TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, i - 1)) |
136 | { | 136 | { |
137 | warn!("complex solution for derefing {:?}: {:?}, ignoring", ty.goal, solution); | 137 | warn!("complex solution for derefing {:?}: {:?}, ignoring", ty.goal, solution); |
@@ -139,7 +139,12 @@ fn deref_by_trait( | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | Some(Canonical { | 141 | Some(Canonical { |
142 | value: vars.0.value[vars.0.value.len() - 1].clone(), | 142 | value: vars |
143 | .0 | ||
144 | .value | ||
145 | .at(&Interner, vars.0.value.len(&Interner) - 1) | ||
146 | .assert_ty_ref(&Interner) | ||
147 | .clone(), | ||
143 | binders: vars.0.binders.clone(), | 148 | binders: vars.0.binders.clone(), |
144 | }) | 149 | }) |
145 | } | 150 | } |