mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
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
This commit is contained in:
parent
f7112371ee
commit
fcffa6ba6b
1 changed files with 4 additions and 3 deletions
|
@ -15,7 +15,7 @@ pub use crate::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub trait CheckCanceled: panic::RefUnwindSafe {
|
pub trait CheckCanceled {
|
||||||
/// Aborts current query if there are pending changes.
|
/// Aborts current query if there are pending changes.
|
||||||
///
|
///
|
||||||
/// rust-analyzer needs to be able to answer semantic questions about the
|
/// rust-analyzer needs to be able to answer semantic questions about the
|
||||||
|
@ -36,14 +36,15 @@ pub trait CheckCanceled: panic::RefUnwindSafe {
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
F: FnOnce(&Self) -> T + panic::UnwindSafe,
|
F: FnOnce(&Self) -> T + panic::UnwindSafe,
|
||||||
{
|
{
|
||||||
panic::catch_unwind(|| f(self)).map_err(|err| match err.downcast::<Canceled>() {
|
let this = panic::AssertUnwindSafe(self);
|
||||||
|
panic::catch_unwind(|| f(*this)).map_err(|err| match err.downcast::<Canceled>() {
|
||||||
Ok(canceled) => *canceled,
|
Ok(canceled) => *canceled,
|
||||||
Err(payload) => panic::resume_unwind(payload),
|
Err(payload) => panic::resume_unwind(payload),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: salsa::Database + panic::RefUnwindSafe> CheckCanceled for T {
|
impl<T: salsa::Database> CheckCanceled for T {
|
||||||
fn check_canceled(&self) {
|
fn check_canceled(&self) {
|
||||||
if self.salsa_runtime().is_current_revision_canceled() {
|
if self.salsa_runtime().is_current_revision_canceled() {
|
||||||
Canceled::throw()
|
Canceled::throw()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue