diff options
Diffstat (limited to 'crates/ra_hir/src/ty/traits.rs')
-rw-r--r-- | crates/ra_hir/src/ty/traits.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs index 90a11ac7d..b0f67ae50 100644 --- a/crates/ra_hir/src/ty/traits.rs +++ b/crates/ra_hir/src/ty/traits.rs | |||
@@ -1,9 +1,8 @@ | |||
1 | //! Trait solving using Chalk. | 1 | //! Trait solving using Chalk. |
2 | use std::sync::Arc; | 2 | use std::sync::{Arc, Mutex}; |
3 | 3 | ||
4 | use chalk_ir::cast::Cast; | 4 | use chalk_ir::cast::Cast; |
5 | use log::debug; | 5 | use log::debug; |
6 | use parking_lot::Mutex; | ||
7 | use ra_db::salsa; | 6 | use ra_db::salsa; |
8 | use ra_prof::profile; | 7 | use ra_prof::profile; |
9 | use rustc_hash::FxHashSet; | 8 | use rustc_hash::FxHashSet; |
@@ -30,9 +29,6 @@ impl PartialEq for TraitSolver { | |||
30 | 29 | ||
31 | impl Eq for TraitSolver {} | 30 | impl Eq for TraitSolver {} |
32 | 31 | ||
33 | // FIXME: this impl is WRONG, chalk is not RefUnwindSafe, and this causes #1927 | ||
34 | impl std::panic::RefUnwindSafe for TraitSolver {} | ||
35 | |||
36 | impl TraitSolver { | 32 | impl TraitSolver { |
37 | fn solve( | 33 | fn solve( |
38 | &self, | 34 | &self, |
@@ -41,7 +37,14 @@ impl TraitSolver { | |||
41 | ) -> Option<chalk_solve::Solution> { | 37 | ) -> Option<chalk_solve::Solution> { |
42 | let context = ChalkContext { db, krate: self.krate }; | 38 | let context = ChalkContext { db, krate: self.krate }; |
43 | debug!("solve goal: {:?}", goal); | 39 | debug!("solve goal: {:?}", goal); |
44 | let solution = self.inner.lock().solve(&context, goal); | 40 | let mut solver = match self.inner.lock() { |
41 | Ok(it) => it, | ||
42 | // Our cancellation works via unwinding, but, as chalk is not | ||
43 | // panic-safe, we need to make sure to propagate the cancellation. | ||
44 | // Ideally, we should also make chalk panic-safe. | ||
45 | Err(_) => ra_db::Canceled::throw(), | ||
46 | }; | ||
47 | let solution = solver.solve(&context, goal); | ||
45 | debug!("solve({:?}) => {:?}", goal, solution); | 48 | debug!("solve({:?}) => {:?}", goal, solution); |
46 | solution | 49 | solution |
47 | } | 50 | } |