diff options
Diffstat (limited to 'crates/ra_hir_ty/src/infer/unify.rs')
-rw-r--r-- | crates/ra_hir_ty/src/infer/unify.rs | 5 |
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 | } |