Skip to content

Commit e265150

Browse files
committed
Remove Send traits
1 parent 203d1b0 commit e265150

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ smallvec = { version = "1.12", features = ["const_generics", "const_new"], optio
4040
tracing = { version = "0.1", default-features = false, features = ["std"], optional = true }
4141
want = { version = "0.3", optional = true }
4242

43+
44+
[patch.crates-io]
45+
http = { git = "https://github.com/JanBerktold/http", rev="cc1cc35" }
46+
4347
[dev-dependencies]
4448
form_urlencoded = "1"
4549
futures-channel = { version = "0.3", features = ["sink"] }
@@ -168,6 +172,11 @@ name = "single_threaded"
168172
path = "examples/single_threaded.rs"
169173
required-features = ["full"]
170174

175+
[[example]]
176+
name = "single_threaded_server"
177+
path = "examples/single_threaded_server.rs"
178+
required-features = ["http1", "http2", "server"]
179+
171180
[[example]]
172181
name = "state"
173182
path = "examples/state.rs"

src/body/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,3 @@ pub(crate) use self::length::DecodedLength;
3636

3737
mod incoming;
3838
mod length;
39-
40-
fn _assert_send_sync() {
41-
fn _assert_send<T: Send>() {}
42-
fn _assert_sync<T: Sync>() {}
43-
44-
_assert_send::<Incoming>();
45-
_assert_sync::<Incoming>();
46-
}

src/client/conn/http1.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ mod upgrades {
565565
#[allow(missing_debug_implementations)]
566566
pub struct UpgradeableConnection<T, B>
567567
where
568-
T: Read + Write + Unpin + Send + 'static,
568+
T: Read + Write + Unpin + 'static,
569569
B: Body + 'static,
570570
B::Error: Into<Box<dyn StdError + Send + Sync>>,
571571
{
@@ -574,9 +574,8 @@ mod upgrades {
574574

575575
impl<I, B> Future for UpgradeableConnection<I, B>
576576
where
577-
I: Read + Write + Unpin + Send + 'static,
577+
I: Read + Write + Unpin + 'static,
578578
B: Body + 'static,
579-
B::Data: Send,
580579
B::Error: Into<Box<dyn StdError + Send + Sync>>,
581580
{
582581
type Output = crate::Result<()>;

src/server/conn/http1.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,7 @@ where
192192
/// Enable this connection to support higher-level HTTP upgrades.
193193
///
194194
/// See [the `upgrade` module](crate::upgrade) for more.
195-
pub fn with_upgrades(self) -> UpgradeableConnection<I, S>
196-
where
197-
I: Send,
198-
{
195+
pub fn with_upgrades(self) -> UpgradeableConnection<I, S> {
199196
UpgradeableConnection { inner: Some(self) }
200197
}
201198
}
@@ -494,7 +491,7 @@ impl<I, B, S> Future for UpgradeableConnection<I, S>
494491
where
495492
S: HttpService<IncomingBody, ResBody = B>,
496493
S::Error: Into<Box<dyn StdError + Send + Sync>>,
497-
I: Read + Write + Unpin + Send + 'static,
494+
I: Read + Write + Unpin + 'static,
498495
B: Body + 'static,
499496
B::Error: Into<Box<dyn StdError + Send + Sync>>,
500497
{
@@ -504,6 +501,7 @@ where
504501
match ready!(Pin::new(&mut self.inner.as_mut().unwrap().conn).poll(cx)) {
505502
Ok(proto::Dispatched::Shutdown) => Poll::Ready(Ok(())),
506503
Ok(proto::Dispatched::Upgrade(pending)) => {
504+
println!("upgrade");
507505
let (io, buf, _) = self.inner.take().unwrap().conn.into_inner();
508506
pending.fulfill(Upgraded::new(io, buf));
509507
Poll::Ready(Ok(()))

src/upgrade.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ use crate::common::io::Rewind;
6363
/// Alternatively, if the exact type is known, this can be deconstructed
6464
/// into its parts.
6565
pub struct Upgraded {
66-
io: Rewind<Box<dyn Io + Send>>,
66+
io: Rewind<Box<dyn Io>>,
6767
}
6868

6969
/// A future for a possible HTTP upgrade.
@@ -137,7 +137,7 @@ impl Upgraded {
137137
))]
138138
pub(super) fn new<T>(io: T, read_buf: Bytes) -> Self
139139
where
140-
T: Read + Write + Unpin + Send + 'static,
140+
T: Read + Write + Unpin + 'static,
141141
{
142142
Upgraded {
143143
io: Rewind::new_buffered(Box::new(io), read_buf),
@@ -295,7 +295,7 @@ pub(super) trait Io: Read + Write + Unpin + 'static {
295295

296296
impl<T: Read + Write + Unpin + 'static> Io for T {}
297297

298-
impl dyn Io + Send {
298+
impl dyn Io {
299299
fn __hyper_is<T: Io>(&self) -> bool {
300300
let t = TypeId::of::<T>();
301301
self.__hyper_type_id() == t

0 commit comments

Comments
 (0)