mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 14:51:48 +00:00
implement RefUnwindSafe
This commit is contained in:
parent
64455ad701
commit
f72c031eb9
4 changed files with 16 additions and 6 deletions
|
@ -20,7 +20,7 @@ pub use crate::{
|
|||
loc2id::LocationIntener,
|
||||
};
|
||||
|
||||
pub trait BaseDatabase: salsa::Database {
|
||||
pub trait BaseDatabase: salsa::Database + panic::RefUnwindSafe {
|
||||
fn check_canceled(&self) -> Cancelable<()> {
|
||||
self.salsa_runtime()
|
||||
.if_current_revision_is_canceled(Canceled::throw);
|
||||
|
@ -31,8 +31,7 @@ pub trait BaseDatabase: salsa::Database {
|
|||
&self,
|
||||
f: F,
|
||||
) -> Result<T, Canceled> {
|
||||
let me = panic::AssertUnwindSafe(self);
|
||||
panic::catch_unwind(|| f(me.0)).map_err(|err| match err.downcast::<Canceled>() {
|
||||
panic::catch_unwind(|| f(self)).map_err(|err| match err.downcast::<Canceled>() {
|
||||
Ok(canceled) => *canceled,
|
||||
Err(payload) => panic::resume_unwind(payload),
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::hash::Hash;
|
||||
use std::{panic, hash::Hash};
|
||||
|
||||
use parking_lot::Mutex;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
@ -70,6 +70,15 @@ where
|
|||
map: Mutex<Loc2IdMap<LOC, ID>>,
|
||||
}
|
||||
|
||||
impl<LOC, ID> panic::RefUnwindSafe for LocationIntener<LOC, ID>
|
||||
where
|
||||
ID: ArenaId + Clone,
|
||||
LOC: Clone + Eq + Hash,
|
||||
ID: panic::RefUnwindSafe,
|
||||
LOC: panic::RefUnwindSafe,
|
||||
{
|
||||
}
|
||||
|
||||
impl<LOC, ID> Default for LocationIntener<LOC, ID>
|
||||
where
|
||||
ID: ArenaId + Clone,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue