From 3cd2be4695bd06898b736809ade2cceec5b924da Mon Sep 17 00:00:00 2001 From: Yasir Shariff <141004977+shariffdev@users.noreply.github.com> Date: Tue, 10 Oct 2023 23:31:53 +0300 Subject: [PATCH] chore: Restrict GasHook type to require RefUnwindSafe and UnwindSafe to avoid breaking release (#323) --- workspaces/src/types/gas_meter.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/workspaces/src/types/gas_meter.rs b/workspaces/src/types/gas_meter.rs index f64576f8..7b75f2b6 100644 --- a/workspaces/src/types/gas_meter.rs +++ b/workspaces/src/types/gas_meter.rs @@ -1,3 +1,4 @@ +use std::panic::{RefUnwindSafe, UnwindSafe}; use std::sync::{Arc, Mutex}; use super::Gas; @@ -7,7 +8,11 @@ use crate::Worker; /// A hook that is called on every transaction that is sent to the network. /// This is useful for debugging purposes, or for tracking the amount of gas /// that is being used. -pub type GasHook = Arc Result<()> + Send + Sync>; +/// +/// The auto-traits [`Send`], [`Sync`], [`UnwindSafe`] and [`RefUnwindSafe`] are added explicitly because they +/// do not fall under the rules the compiler uses to automatically add them. +/// See here: +pub type GasHook = Arc Result<()> + Send + Sync + UnwindSafe + RefUnwindSafe>; /// Allows you to meter the amount of gas consumed by transaction(s). /// Note: This only works with transactions that resolve to [`crate::result::ExecutionFinalResult`]