From f613c48d2e2afa1761623d186d11c1719f9ef3f7 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 20 May 2019 18:31:12 +0200 Subject: Use fuel branch for Chalk This makes sure we don't take too long in trait solving. --- crates/ra_hir/src/ty/traits.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs index f39749cab..e6c78c0d4 100644 --- a/crates/ra_hir/src/ty/traits.rs +++ b/crates/ra_hir/src/ty/traits.rs @@ -61,7 +61,7 @@ fn solve( let context = ChalkContext { db, krate }; let solver = db.solver(krate); debug!("solve goal: {:?}", goal); - let solution = solver.lock().unwrap().solve(&context, goal); + let solution = solver.lock().unwrap().solve_with_fuel(&context, goal, Some(1000)); debug!("solve({:?}) => {:?}", goal, solution); solution } -- cgit v1.2.3 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') 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