diff options
author | Aleksey Kladov <[email protected]> | 2019-09-27 18:47:36 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-09-27 18:47:36 +0100 |
commit | 35f1655b0bc0452ee5f2bed521ebb12c17a8a20d (patch) | |
tree | 90f434b1aa7326f35c73c2ed2e0b73eeb78da8ef | |
parent | 2b69c84396cf376b496e7de3c954400e51b5fc24 (diff) |
replace horrible hack with a slightly less horrible one
-rw-r--r-- | crates/ra_db/src/lib.rs | 5 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/traits.rs | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index c54791b7a..603daed37 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs | |||
@@ -32,11 +32,10 @@ pub trait CheckCanceled { | |||
32 | 32 | ||
33 | fn catch_canceled<F, T>(&self, f: F) -> Result<T, Canceled> | 33 | fn catch_canceled<F, T>(&self, f: F) -> Result<T, Canceled> |
34 | where | 34 | where |
35 | Self: Sized, | 35 | Self: Sized + panic::RefUnwindSafe, |
36 | F: FnOnce(&Self) -> T + panic::UnwindSafe, | 36 | F: FnOnce(&Self) -> T + panic::UnwindSafe, |
37 | { | 37 | { |
38 | let this = panic::AssertUnwindSafe(self); | 38 | panic::catch_unwind(|| f(self)).map_err(|err| match err.downcast::<Canceled>() { |
39 | panic::catch_unwind(|| f(*this)).map_err(|err| match err.downcast::<Canceled>() { | ||
40 | Ok(canceled) => *canceled, | 39 | Ok(canceled) => *canceled, |
41 | Err(payload) => panic::resume_unwind(payload), | 40 | Err(payload) => panic::resume_unwind(payload), |
42 | }) | 41 | }) |
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs index d11dab294..90a11ac7d 100644 --- a/crates/ra_hir/src/ty/traits.rs +++ b/crates/ra_hir/src/ty/traits.rs | |||
@@ -30,6 +30,9 @@ impl PartialEq for TraitSolver { | |||
30 | 30 | ||
31 | impl Eq for TraitSolver {} | 31 | impl Eq for TraitSolver {} |
32 | 32 | ||
33 | // FIXME: this impl is WRONG, chalk is not RefUnwindSafe, and this causes #1927 | ||
34 | impl std::panic::RefUnwindSafe for TraitSolver {} | ||
35 | |||
33 | impl TraitSolver { | 36 | impl TraitSolver { |
34 | fn solve( | 37 | fn solve( |
35 | &self, | 38 | &self, |