aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/infer/unify.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-02-21 12:47:49 +0000
committerFlorian Diebold <[email protected]>2020-02-21 13:06:19 +0000
commite50201345ecc91b9eeb284cd04c6b55f9c5ce0fd (patch)
treebfea7d01b69ecc97d57ba7749c08682a7c82169e /crates/ra_hir_ty/src/infer/unify.rs
parentdb1bbb11fbe85a5230452359e80535a2169d0929 (diff)
Normalize associated types in types coming from Chalk
Fixes #3232.
Diffstat (limited to 'crates/ra_hir_ty/src/infer/unify.rs')
-rw-r--r--crates/ra_hir_ty/src/infer/unify.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_hir_ty/src/infer/unify.rs b/crates/ra_hir_ty/src/infer/unify.rs
index 9c7996572..2d03c5c33 100644
--- a/crates/ra_hir_ty/src/infer/unify.rs
+++ b/crates/ra_hir_ty/src/infer/unify.rs
@@ -161,7 +161,10 @@ impl<T> Canonicalized<T> {
161 let new_vars = Substs((0..solution.num_vars).map(|_| ctx.table.new_type_var()).collect()); 161 let new_vars = Substs((0..solution.num_vars).map(|_| ctx.table.new_type_var()).collect());
162 for (i, ty) in solution.value.into_iter().enumerate() { 162 for (i, ty) in solution.value.into_iter().enumerate() {
163 let var = self.free_vars[i]; 163 let var = self.free_vars[i];
164 ctx.table.unify(&Ty::Infer(var), &ty.subst_bound_vars(&new_vars)); 164 // eagerly replace projections in the type; we may be getting types
165 // e.g. from where clauses where this hasn't happened yet
166 let ty = ctx.normalize_associated_types_in(ty.subst_bound_vars(&new_vars));
167 ctx.table.unify(&Ty::Infer(var), &ty);
165 } 168 }
166 } 169 }
167} 170}