From fcffa6ba6bfc8647a8f3aa858b05981d12a6e74f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 18 May 2019 13:04:09 +0300 Subject: 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 --- crates/ra_db/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates') 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::{ }, }; -pub trait CheckCanceled: panic::RefUnwindSafe { +pub trait CheckCanceled { /// Aborts current query if there are pending changes. /// /// rust-analyzer needs to be able to answer semantic questions about the @@ -36,14 +36,15 @@ pub trait CheckCanceled: panic::RefUnwindSafe { Self: Sized, F: FnOnce(&Self) -> T + panic::UnwindSafe, { - panic::catch_unwind(|| f(self)).map_err(|err| match err.downcast::() { + let this = panic::AssertUnwindSafe(self); + panic::catch_unwind(|| f(*this)).map_err(|err| match err.downcast::() { Ok(canceled) => *canceled, Err(payload) => panic::resume_unwind(payload), }) } } -impl CheckCanceled for T { +impl CheckCanceled for T { fn check_canceled(&self) { if self.salsa_runtime().is_current_revision_canceled() { Canceled::throw() -- cgit v1.2.3