Skip to content

Commit fcffa6b

Browse files
committed
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 * #1283 * rust-lang/rust#60444 * rust-lang/rust#58291 closes #1283
1 parent f711237 commit fcffa6b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crates/ra_db/src/lib.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub use crate::{
1515
},
1616
};
1717

18-
pub trait CheckCanceled: panic::RefUnwindSafe {
18+
pub trait CheckCanceled {
1919
/// Aborts current query if there are pending changes.
2020
///
2121
/// rust-analyzer needs to be able to answer semantic questions about the
@@ -36,14 +36,15 @@ pub trait CheckCanceled: panic::RefUnwindSafe {
3636
Self: Sized,
3737
F: FnOnce(&Self) -> T + panic::UnwindSafe,
3838
{
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>() {
4041
Ok(canceled) => *canceled,
4142
Err(payload) => panic::resume_unwind(payload),
4243
})
4344
}
4445
}
4546

46-
impl<T: salsa::Database + panic::RefUnwindSafe> CheckCanceled for T {
47+
impl<T: salsa::Database> CheckCanceled for T {
4748
fn check_canceled(&self) {
4849
if self.salsa_runtime().is_current_revision_canceled() {
4950
Canceled::throw()

0 commit comments

Comments
 (0)