diff options
author | Florian Diebold <[email protected]> | 2019-05-20 17:31:41 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-05-21 19:40:29 +0100 |
commit | ced971ee9f877d866456bd0e34734056595b1a57 (patch) | |
tree | ecada644ef5a0270689036d266d90eee899da560 | |
parent | f613c48d2e2afa1761623d186d11c1719f9ef3f7 (diff) |
Fix crash with int vars in canonicalization
-rw-r--r-- | crates/ra_hir/src/ty/infer/unify.rs | 7 |
1 files changed, 6 insertions, 1 deletions
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 | |||
56 | self.var_stack.pop(); | 56 | self.var_stack.pop(); |
57 | result | 57 | result |
58 | } else { | 58 | } else { |
59 | let free_var = InferTy::TypeVar(self.ctx.var_unification_table.find(inner)); | 59 | let root = self.ctx.var_unification_table.find(inner); |
60 | let free_var = match tv { | ||
61 | InferTy::TypeVar(_) => InferTy::TypeVar(root), | ||
62 | InferTy::IntVar(_) => InferTy::IntVar(root), | ||
63 | InferTy::FloatVar(_) => InferTy::FloatVar(root), | ||
64 | }; | ||
60 | let position = self.add(free_var); | 65 | let position = self.add(free_var); |
61 | Ty::Bound(position as u32) | 66 | Ty::Bound(position as u32) |
62 | } | 67 | } |