From 4158a4dba59a270fabde9825dc661024ad98bbb1 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 18 Jan 2019 07:12:17 -0500 Subject: [PATCH 1/2] move the RefUnwindSafe impls to shared/local state structs --- src/runtime.rs | 9 ++------- src/runtime/local_state.rs | 2 ++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/runtime.rs b/src/runtime.rs index d63ba8c9..4b9c447c 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -37,13 +37,6 @@ pub struct Runtime { shared_state: Arc>, } -impl std::panic::RefUnwindSafe for Runtime -where - DB: Database, - DB::DatabaseStorage: std::panic::RefUnwindSafe, -{ -} - impl Default for Runtime where DB: Database, @@ -446,6 +439,8 @@ struct SharedState { dependency_graph: Mutex>, } +impl std::panic::RefUnwindSafe for SharedState where DB: Database {} + impl Default for SharedState { fn default() -> Self { SharedState { diff --git a/src/runtime/local_state.rs b/src/runtime/local_state.rs index 496d3afc..a3d893d0 100644 --- a/src/runtime/local_state.rs +++ b/src/runtime/local_state.rs @@ -80,6 +80,8 @@ impl LocalState { } } +impl std::panic::RefUnwindSafe for LocalState where DB: Database {} + /// When a query is pushed onto the `active_query` stack, this guard /// is returned to represent its slot. The guard can be used to pop /// the query from the stack -- in the case of unwinding, the guard's From 4ed95c4aae2c56e10861f9e307ecac14e941ef2f Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 18 Jan 2019 08:53:12 -0500 Subject: [PATCH 2/2] include condition that the storage be unwind safe --- src/runtime.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/runtime.rs b/src/runtime.rs index 4b9c447c..a06350bc 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -439,7 +439,12 @@ struct SharedState { dependency_graph: Mutex>, } -impl std::panic::RefUnwindSafe for SharedState where DB: Database {} +impl std::panic::RefUnwindSafe for SharedState +where + DB: Database, + DB::DatabaseStorage: std::panic::RefUnwindSafe, +{ +} impl Default for SharedState { fn default() -> Self {