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/Cargo.toml | 6 +++--- crates/ra_hir/src/ty/traits.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml index cb4a8c3e3..294d047d8 100644 --- a/crates/ra_hir/Cargo.toml +++ b/crates/ra_hir/Cargo.toml @@ -21,9 +21,9 @@ tt = { path = "../ra_tt", package = "ra_tt" } test_utils = { path = "../test_utils" } ra_prof = { path = "../ra_prof" } -chalk-solve = { git = "https://github.com/rust-lang/chalk.git" } -chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git" } -chalk-ir = { git = "https://github.com/rust-lang/chalk.git" } +chalk-solve = { git = "https://github.com/flodiebold/chalk.git", branch = "fuel" } +chalk-rust-ir = { git = "https://github.com/flodiebold/chalk.git", branch = "fuel" } +chalk-ir = { git = "https://github.com/flodiebold/chalk.git", branch = "fuel" } [dev-dependencies] flexi_logger = "0.11.0" 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') 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