From 64bcf13563c5c18825692c63035cb1843a577b28 Mon Sep 17 00:00:00 2001 From: Ruben De Smet Date: Thu, 2 Jan 2025 16:46:41 +0100 Subject: [PATCH] fix: Ensure Send+Sync bounds on SentryLayer and SentryService Updates PhantomData usage in SentryLayer and SentryService to explicitly ensure Send+Sync trait bounds using the fn pointer pattern as documented in the Rust Nomicon. --- sentry-tower/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sentry-tower/src/lib.rs b/sentry-tower/src/lib.rs index 4cd9818da..71fb05e84 100644 --- a/sentry-tower/src/lib.rs +++ b/sentry-tower/src/lib.rs @@ -196,7 +196,9 @@ where H: Into>, { provider: P, - _hub: PhantomData<(H, Request)>, + // `fn` is used to assert that SentryLayer will be Send+Sync + // (https://doc.rust-lang.org/nomicon/phantom-data.html#table-of-phantomdata-patterns) + _hub: PhantomData, } impl Layer for SentryLayer @@ -250,7 +252,9 @@ where { service: S, provider: P, - _hub: PhantomData<(H, Request)>, + // `fn` is used to assert that SentryService will be Send+Sync + // (https://doc.rust-lang.org/nomicon/phantom-data.html#table-of-phantomdata-patterns) + _hub: PhantomData, } impl Service for SentryService