Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions sentry-tower/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ where
H: Into<Arc<Hub>>,
{
provider: P,
_hub: PhantomData<(H, Request)>,
_hub: PhantomData<(H, fn() -> Request)>,
}

impl<S, P, H, Request> Layer<S> for SentryLayer<P, H, Request>
Expand Down Expand Up @@ -250,7 +250,7 @@ where
{
service: S,
provider: P,
_hub: PhantomData<(H, Request)>,
_hub: PhantomData<(H, fn() -> Request)>,
}

impl<S, Request, P, H> Service<Request> for SentryService<S, P, H, Request>
Expand Down Expand Up @@ -326,3 +326,21 @@ impl<S, Request> NewSentryService<S, Request> {
}
}
}

#[cfg(test)]
mod tests {
use super::*;
use std::rc::Rc;

fn assert_sync<T: Sync>() {}

#[test]
fn test_layer_is_sync_when_request_isnt() {
assert_sync::<NewSentryLayer<Rc<()>>>(); // Rc<()> is not Sync
}

#[test]
fn test_service_is_sync_when_request_isnt() {
assert_sync::<NewSentryService<(), Rc<()>>>(); // Rc<()> is not Sync
}
}
Loading