diff --git a/sentry-tower/src/lib.rs b/sentry-tower/src/lib.rs index 4cd9818d..cccf2e8f 100644 --- a/sentry-tower/src/lib.rs +++ b/sentry-tower/src/lib.rs @@ -196,7 +196,7 @@ where H: Into>, { provider: P, - _hub: PhantomData<(H, Request)>, + _hub: PhantomData<(H, fn() -> Request)>, } impl Layer for SentryLayer @@ -250,7 +250,7 @@ where { service: S, provider: P, - _hub: PhantomData<(H, Request)>, + _hub: PhantomData<(H, fn() -> Request)>, } impl Service for SentryService @@ -326,3 +326,21 @@ impl NewSentryService { } } } + +#[cfg(test)] +mod tests { + use super::*; + use std::rc::Rc; + + fn assert_sync() {} + + #[test] + fn test_layer_is_sync_when_request_isnt() { + assert_sync::>>(); // Rc<()> is not Sync + } + + #[test] + fn test_service_is_sync_when_request_isnt() { + assert_sync::>>(); // Rc<()> is not Sync + } +}