diff options
author | Aleksey Kladov <[email protected]> | 2019-05-18 11:04:09 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-05-18 11:05:42 +0100 |
commit | fcffa6ba6bfc8647a8f3aa858b05981d12a6e74f (patch) | |
tree | 059bd1a8b2fb0e96b1940f25de1f11c3cb35aa7f /crates/ra_db/src | |
parent | f7112371ee646d8ecc68861e9fe832af9729878e (diff) |
Assert that DB is unwind-safe, instead of proving
Unfortunately, that `: RefUnwindSafe` bound gives rustc a hard time,
so let's remove it for know.
See
* https://github.com/rust-analyzer/rust-analyzer/issues/1283
* https://github.com/rust-lang/rust/pull/60444
* https://github.com/rust-lang/rust/issues/58291
closes #1283
Diffstat (limited to 'crates/ra_db/src')
-rw-r--r-- | crates/ra_db/src/lib.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index 1cd400752..bf567721a 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs | |||
@@ -15,7 +15,7 @@ pub use crate::{ | |||
15 | }, | 15 | }, |
16 | }; | 16 | }; |
17 | 17 | ||
18 | pub trait CheckCanceled: panic::RefUnwindSafe { | 18 | pub trait CheckCanceled { |
19 | /// Aborts current query if there are pending changes. | 19 | /// Aborts current query if there are pending changes. |
20 | /// | 20 | /// |
21 | /// rust-analyzer needs to be able to answer semantic questions about the | 21 | /// rust-analyzer needs to be able to answer semantic questions about the |
@@ -36,14 +36,15 @@ pub trait CheckCanceled: panic::RefUnwindSafe { | |||
36 | Self: Sized, | 36 | Self: Sized, |
37 | F: FnOnce(&Self) -> T + panic::UnwindSafe, | 37 | F: FnOnce(&Self) -> T + panic::UnwindSafe, |
38 | { | 38 | { |
39 | panic::catch_unwind(|| f(self)).map_err(|err| match err.downcast::<Canceled>() { | 39 | let this = panic::AssertUnwindSafe(self); |
40 | panic::catch_unwind(|| f(*this)).map_err(|err| match err.downcast::<Canceled>() { | ||
40 | Ok(canceled) => *canceled, | 41 | Ok(canceled) => *canceled, |
41 | Err(payload) => panic::resume_unwind(payload), | 42 | Err(payload) => panic::resume_unwind(payload), |
42 | }) | 43 | }) |
43 | } | 44 | } |
44 | } | 45 | } |
45 | 46 | ||
46 | impl<T: salsa::Database + panic::RefUnwindSafe> CheckCanceled for T { | 47 | impl<T: salsa::Database> CheckCanceled for T { |
47 | fn check_canceled(&self) { | 48 | fn check_canceled(&self) { |
48 | if self.salsa_runtime().is_current_revision_canceled() { | 49 | if self.salsa_runtime().is_current_revision_canceled() { |
49 | Canceled::throw() | 50 | Canceled::throw() |