diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-21 20:07:35 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-21 20:07:35 +0100 |
commit | 366ad6f03ba2296f09cb79ea139fa53a132fa651 (patch) | |
tree | ecada644ef5a0270689036d266d90eee899da560 /crates/ra_hir | |
parent | ed943adb29e6eddb482377a21908a8ed66c6cc21 (diff) | |
parent | ced971ee9f877d866456bd0e34734056595b1a57 (diff) |
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]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/Cargo.toml | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer/unify.rs | 7 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/traits.rs | 2 |
3 files changed, 10 insertions, 5 deletions
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" } | |||
21 | test_utils = { path = "../test_utils" } | 21 | test_utils = { path = "../test_utils" } |
22 | ra_prof = { path = "../ra_prof" } | 22 | ra_prof = { path = "../ra_prof" } |
23 | 23 | ||
24 | chalk-solve = { 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/rust-lang/chalk.git" } | 25 | chalk-rust-ir = { git = "https://github.com/flodiebold/chalk.git", branch = "fuel" } |
26 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git" } | 26 | chalk-ir = { git = "https://github.com/flodiebold/chalk.git", branch = "fuel" } |
27 | 27 | ||
28 | [dev-dependencies] | 28 | [dev-dependencies] |
29 | flexi_logger = "0.11.0" | 29 | flexi_logger = "0.11.0" |
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 | } |
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( | |||
61 | let context = ChalkContext { db, krate }; | 61 | let context = ChalkContext { db, krate }; |
62 | let solver = db.solver(krate); | 62 | let solver = db.solver(krate); |
63 | debug!("solve goal: {:?}", goal); | 63 | 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)); |
65 | debug!("solve({:?}) => {:?}", goal, solution); | 65 | debug!("solve({:?}) => {:?}", goal, solution); |
66 | solution | 66 | solution |
67 | } | 67 | } |