aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/ty/traits.rs15
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.
2use std::sync::Arc; 2use std::sync::{Arc, Mutex};
3 3
4use chalk_ir::cast::Cast; 4use chalk_ir::cast::Cast;
5use log::debug; 5use log::debug;
6use parking_lot::Mutex;
7use ra_db::salsa; 6use ra_db::salsa;
8use ra_prof::profile; 7use ra_prof::profile;
9use rustc_hash::FxHashSet; 8use rustc_hash::FxHashSet;
@@ -30,9 +29,6 @@ impl PartialEq for TraitSolver {
30 29
31impl Eq for TraitSolver {} 30impl Eq for TraitSolver {}
32 31
33// FIXME: this impl is WRONG, chalk is not RefUnwindSafe, and this causes #1927
34impl std::panic::RefUnwindSafe for TraitSolver {}
35
36impl TraitSolver { 32impl 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 }