Skip to content

Commit 4fc3faa

Browse files
committed
Relax implicit Send / Sync bounds (#3555)
1 parent a05920c commit 4fc3faa

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

axum/src/routing/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ where
592592
/// See [`Router::as_service`] for more details.
593593
pub struct RouterAsService<'a, B, S = ()> {
594594
router: &'a mut Router<S>,
595-
_marker: PhantomData<B>,
595+
_marker: PhantomData<fn(B)>,
596596
}
597597

598598
impl<B> Service<Request<B>> for RouterAsService<'_, B, ()>
@@ -631,7 +631,7 @@ where
631631
/// See [`Router::into_service`] for more details.
632632
pub struct RouterIntoService<B, S = ()> {
633633
router: Router<S>,
634-
_marker: PhantomData<B>,
634+
_marker: PhantomData<fn(B)>,
635635
}
636636

637637
impl<B, S> Clone for RouterIntoService<B, S>
@@ -800,4 +800,8 @@ fn traits() {
800800
use crate::test_helpers::*;
801801
assert_send::<Router<()>>();
802802
assert_sync::<Router<()>>();
803+
assert_send::<RouterAsService<'static, Body, ()>>();
804+
assert_sync::<RouterAsService<'static, Body, ()>>();
805+
assert_send::<RouterIntoService<Body, ()>>();
806+
assert_sync::<RouterIntoService<Body, ()>>();
803807
}

axum/src/serve/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ where
114114
pub struct Serve<L, M, S> {
115115
listener: L,
116116
make_service: M,
117-
_marker: PhantomData<S>,
117+
_marker: PhantomData<fn() -> S>,
118118
}
119119

120120
#[cfg(all(feature = "tokio", any(feature = "http1", feature = "http2")))]
@@ -239,7 +239,7 @@ pub struct WithGracefulShutdown<L, M, S, F> {
239239
listener: L,
240240
make_service: M,
241241
signal: F,
242-
_marker: PhantomData<S>,
242+
_marker: PhantomData<fn() -> S>,
243243
}
244244

245245
#[cfg(all(feature = "tokio", any(feature = "http1", feature = "http2")))]

0 commit comments

Comments
 (0)