diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a0ae451..7a34f59d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [`sentry_core::ClientOptions`](https://docs.rs/sentry-core/latest/sentry_core/struct.ClientOptions.html) fields [`before_send_log`](https://docs.rs/sentry-core/latest/sentry_core/struct.ClientOptions.html#structfield.before_send_log), [`enable_logs`](https://docs.rs/sentry-core/latest/sentry_core/struct.ClientOptions.html#structfield.enable_logs), [`auto_session_tracking`](https://docs.rs/sentry-core/latest/sentry_core/struct.ClientOptions.html#structfield.auto_session_tracking), and [`session_mode`](https://docs.rs/sentry-core/latest/sentry_core/struct.ClientOptions.html#structfield.session_mode) are no longer gated behind the `logs` and `release-health` feature flags ([#1091](https://github.com/getsentry/sentry-rust/pull/1091)). Code that constructs `ClientOptions` with a full struct literal (without `..Default::default()`), or which exhaustively matches against it, must now include all four fields regardless of enabled features. - [`sentry_core::Scope`](https://docs.rs/sentry-core/latest/sentry_core/struct.Scope.html) can no longer be publicly constructed or exhaustively matched against, even when the `client` feature is disabled ([#1094](https://github.com/getsentry/sentry-rust/pull/1094)). Previously, both of these were possible when `client` was disabled. +- [`sentry_core::Scope::add_event_processor`](https://docs.rs/sentry-core/latest/sentry_core/struct.Scope.html#method.add_event_processor) now requires passed closures to be `RefUnwindSafe` ([#1093](https://github.com/getsentry/sentry-rust/pull/1093)). Thanks to this change, [`sentry_core::Scope`](https://docs.rs/sentry-core/latest/sentry_core/struct.Scope.html) is now [`UnwindSafe`](https://docs.rs/sentry-core/latest/sentry_core/struct.Scope.html#impl-UnwindSafe-for-Scope) regardless of feature flag configuration; previously, `Scope` was only `UnwindSafe` when the `client` feature was disabled. was disabled. - [`sentry_tracing::EventMapping](https://docs.rs/sentry-tracing/latest/sentry_tracing/enum.EventMapping.html) is now ``#[non_exhaustive]`` ([#1097](https://github.com/getsentry/sentry-rust/pull/1097)). ## 0.47.0 diff --git a/sentry-core/src/scope/noop.rs b/sentry-core/src/scope/noop.rs index cf49f821..13df41f4 100644 --- a/sentry-core/src/scope/noop.rs +++ b/sentry-core/src/scope/noop.rs @@ -1,4 +1,5 @@ use std::fmt; +use std::panic::RefUnwindSafe; #[cfg(feature = "logs")] use crate::protocol::Log; @@ -101,7 +102,7 @@ impl Scope { /// Add an event processor to the scope. pub fn add_event_processor(&mut self, f: F) where - F: Fn(Event<'static>) -> Option> + Send + Sync + 'static, + F: Fn(Event<'static>) -> Option> + Send + Sync + RefUnwindSafe + 'static, { let _f = f; minimal_unreachable!(); diff --git a/sentry-core/src/scope/real.rs b/sentry-core/src/scope/real.rs index 125c8650..37479cc3 100644 --- a/sentry-core/src/scope/real.rs +++ b/sentry-core/src/scope/real.rs @@ -1,6 +1,7 @@ use std::borrow::Cow; use std::collections::{HashMap, VecDeque}; use std::fmt; +use std::panic::RefUnwindSafe; #[cfg(feature = "release-health")] use std::sync::Mutex; use std::sync::{Arc, PoisonError, RwLock}; @@ -21,7 +22,8 @@ pub struct Stack { layers: Vec, } -type EventProcessor = Arc) -> Option> + Send + Sync>; +type EventProcessor = + Arc) -> Option> + Send + Sync + RefUnwindSafe>; /// Holds contextual data for the current scope. /// @@ -252,7 +254,7 @@ impl Scope { /// Add an event processor to the scope. pub fn add_event_processor(&mut self, f: F) where - F: Fn(Event<'static>) -> Option> + Send + Sync + 'static, + F: Fn(Event<'static>) -> Option> + Send + Sync + RefUnwindSafe + 'static, { Arc::make_mut(&mut self.event_processors).push(Arc::new(f)); }