From 35f1655b0bc0452ee5f2bed521ebb12c17a8a20d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 27 Sep 2019 20:47:36 +0300 Subject: replace horrible hack with a slightly less horrible one --- crates/ra_db/src/lib.rs | 5 ++--- crates/ra_hir/src/ty/traits.rs | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'crates') 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 { fn catch_canceled(&self, f: F) -> Result where - Self: Sized, + Self: Sized + panic::RefUnwindSafe, F: FnOnce(&Self) -> T + panic::UnwindSafe, { - let this = panic::AssertUnwindSafe(self); - panic::catch_unwind(|| f(*this)).map_err(|err| match err.downcast::() { + panic::catch_unwind(|| f(self)).map_err(|err| match err.downcast::() { Ok(canceled) => *canceled, Err(payload) => panic::resume_unwind(payload), }) 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 { impl Eq for TraitSolver {} +// FIXME: this impl is WRONG, chalk is not RefUnwindSafe, and this causes #1927 +impl std::panic::RefUnwindSafe for TraitSolver {} + impl TraitSolver { fn solve( &self, -- cgit v1.2.3