Skip to content

Commit 366ad6f

Browse files
bors[bot]flodiebold
andcommitted
Merge #1306
1306: Chalk fuel r=matklad a=flodiebold This switches Chalk to my fuel branch, and limits the fuel for trait solving. This should improve worst-case performance; for example, we can now run `ra_cli analysis-stats` against rustc again. This also fixes a bug found doing that. Co-authored-by: Florian Diebold <[email protected]>
2 parents ed943ad + ced971e commit 366ad6f

File tree

4 files changed

+33
-28
lines changed

4 files changed

+33
-28
lines changed

Cargo.lock

+23-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_hir/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ tt = { path = "../ra_tt", package = "ra_tt" }
2121
test_utils = { path = "../test_utils" }
2222
ra_prof = { path = "../ra_prof" }
2323

24-
chalk-solve = { git = "https://github.com/rust-lang/chalk.git" }
25-
chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git" }
26-
chalk-ir = { git = "https://github.com/rust-lang/chalk.git" }
24+
chalk-solve = { git = "https://github.com/flodiebold/chalk.git", branch = "fuel" }
25+
chalk-rust-ir = { git = "https://github.com/flodiebold/chalk.git", branch = "fuel" }
26+
chalk-ir = { git = "https://github.com/flodiebold/chalk.git", branch = "fuel" }
2727

2828
[dev-dependencies]
2929
flexi_logger = "0.11.0"

crates/ra_hir/src/ty/infer/unify.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ where
5656
self.var_stack.pop();
5757
result
5858
} 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+
};
6065
let position = self.add(free_var);
6166
Ty::Bound(position as u32)
6267
}

crates/ra_hir/src/ty/traits.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn solve(
6161
let context = ChalkContext { db, krate };
6262
let solver = db.solver(krate);
6363
debug!("solve goal: {:?}", goal);
64-
let solution = solver.lock().unwrap().solve(&context, goal);
64+
let solution = solver.lock().unwrap().solve_with_fuel(&context, goal, Some(1000));
6565
debug!("solve({:?}) => {:?}", goal, solution);
6666
solution
6767
}

0 commit comments

Comments
 (0)