From ced971ee9f877d866456bd0e34734056595b1a57 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 20 May 2019 18:31:41 +0200 Subject: Fix crash with int vars in canonicalization --- crates/ra_hir/src/ty/infer/unify.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src/ty/infer/unify.rs') diff --git a/crates/ra_hir/src/ty/infer/unify.rs b/crates/ra_hir/src/ty/infer/unify.rs index 8ca7e957d..bc9719725 100644 --- a/crates/ra_hir/src/ty/infer/unify.rs +++ b/crates/ra_hir/src/ty/infer/unify.rs @@ -56,7 +56,12 @@ where self.var_stack.pop(); result } else { - let free_var = InferTy::TypeVar(self.ctx.var_unification_table.find(inner)); + let root = self.ctx.var_unification_table.find(inner); + let free_var = match tv { + InferTy::TypeVar(_) => InferTy::TypeVar(root), + InferTy::IntVar(_) => InferTy::IntVar(root), + InferTy::FloatVar(_) => InferTy::FloatVar(root), + }; let position = self.add(free_var); Ty::Bound(position as u32) } -- cgit v1.2.3