aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/infer
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-21 13:22:06 +0000
committerGitHub <[email protected]>2020-02-21 13:22:06 +0000
commite3037c2631ecb55996b676ce2c18b9df1858abaa (patch)
treebfea7d01b69ecc97d57ba7749c08682a7c82169e /crates/ra_hir_ty/src/infer
parentdb1bbb11fbe85a5230452359e80535a2169d0929 (diff)
parente50201345ecc91b9eeb284cd04c6b55f9c5ce0fd (diff)
Merge #3259
3259: Normalize associated types in types coming from Chalk r=matklad a=flodiebold Fixes #3232. Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-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}