mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-26 06:42:48 +00:00
mark runtime as UnwindSafe
An alternative would be to mark bit of state as runtime safe, but as Runtime directly contains a RefCell we need to mark it as a whole anyway!
This commit is contained in:
parent
add15d83ea
commit
b637e1a9bb
2 changed files with 8 additions and 0 deletions
|
@ -35,6 +35,8 @@ pub struct Runtime<DB: Database> {
|
|||
shared_state: Arc<SharedState<DB>>,
|
||||
}
|
||||
|
||||
impl<DB> std::panic::RefUnwindSafe for Runtime<DB> where DB: Database {}
|
||||
|
||||
impl<DB> Default for Runtime<DB>
|
||||
where
|
||||
DB: Database,
|
||||
|
|
|
@ -63,3 +63,9 @@ fn should_panic_safely() {
|
|||
let result = panic::catch_unwind(AssertUnwindSafe(|| db.panic_safely()));
|
||||
assert!(result.is_ok())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn storages_are_unwind_safe() {
|
||||
fn check_unwind_safe<T: std::panic::UnwindSafe>() {}
|
||||
check_unwind_safe::<&DatabaseStruct>();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue