diff --git a/Cargo.toml b/Cargo.toml index 874eb519b..d63e9f071 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,3 +20,15 @@ members = [ "tower-make", "tower-util", ] + +[patch.crates-io] +tokio = { git = "https://github.com/tokio-rs/tokio" } +tokio-codec = { git = "https://github.com/tokio-rs/tokio" } +tokio-executor = { git = "https://github.com/tokio-rs/tokio" } +tokio-fs = { git = "https://github.com/tokio-rs/tokio" } +tokio-io = { git = "https://github.com/tokio-rs/tokio" } +tokio-macros = { git = "https://github.com/tokio-rs/tokio" } +tokio-net = { git = "https://github.com/tokio-rs/tokio" } +tokio-sync = { git = "https://github.com/tokio-rs/tokio" } +tokio-test = { git = "https://github.com/tokio-rs/tokio" } +tokio-timer = { git = "https://github.com/tokio-rs/tokio" } diff --git a/ci/patch.toml b/ci/patch.toml index 54633ad36..e56b42824 100644 --- a/ci/patch.toml +++ b/ci/patch.toml @@ -16,3 +16,14 @@ tower-spawn-ready = { path = "tower-spawn-ready" } tower-test = { path = "tower-test" } tower-timeout = { path = "tower-timeout" } tower-util = { path = "tower-util" } + +tokio = { git = "https://github.com/tokio-rs/tokio" } +tokio-codec = { git = "https://github.com/tokio-rs/tokio" } +tokio-executor = { git = "https://github.com/tokio-rs/tokio" } +tokio-fs = { git = "https://github.com/tokio-rs/tokio" } +tokio-io = { git = "https://github.com/tokio-rs/tokio" } +tokio-macros = { git = "https://github.com/tokio-rs/tokio" } +tokio-net = { git = "https://github.com/tokio-rs/tokio" } +tokio-sync = { git = "https://github.com/tokio-rs/tokio" } +tokio-test = { git = "https://github.com/tokio-rs/tokio" } +tokio-timer = { git = "https://github.com/tokio-rs/tokio" } diff --git a/tower-balance/Cargo.toml b/tower-balance/Cargo.toml index 05e33ea52..64da90a4d 100644 --- a/tower-balance/Cargo.toml +++ b/tower-balance/Cargo.toml @@ -28,7 +28,7 @@ default = ["log"] [dependencies] futures-util-preview = "=0.3.0-alpha.18" futures-core-preview = "=0.3.0-alpha.18" -pin-project = "=0.4.0-alpha.11" +pin-project = "0.4" indexmap = "1.0.2" tracing = "0.1" rand = "0.6.5" diff --git a/tower-balance/examples/demo.rs b/tower-balance/examples/demo.rs index 399e53bbb..424463934 100644 --- a/tower-balance/examples/demo.rs +++ b/tower-balance/examples/demo.rs @@ -86,7 +86,7 @@ where type Service = S; type Error = Error; fn poll_discover( - mut self: Pin<&mut Self>, + self: Pin<&mut Self>, _: &mut Context<'_>, ) -> Poll, Self::Error>> { match self.project().0.pop() { diff --git a/tower-balance/src/p2c/make.rs b/tower-balance/src/p2c/make.rs index 85386f8f5..3d22fa340 100644 --- a/tower-balance/src/p2c/make.rs +++ b/tower-balance/src/p2c/make.rs @@ -74,7 +74,7 @@ where { type Output = Result, E>; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.project(); let inner = ready!(this.inner.poll(cx))?; let svc = Balance::new(inner, this.rng.clone()); diff --git a/tower-balance/src/p2c/service.rs b/tower-balance/src/p2c/service.rs index 2b9b3f100..29f73fcf6 100644 --- a/tower-balance/src/p2c/service.rs +++ b/tower-balance/src/p2c/service.rs @@ -340,7 +340,7 @@ where impl, Req> Future for UnreadyService { type Output = Result<(K, S), (K, Error)>; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.project(); if let Poll::Ready(Ok(())) = this.cancel.poll(cx) { diff --git a/tower-balance/src/pool/mod.rs b/tower-balance/src/pool/mod.rs index 20aa3e941..a8d978f96 100644 --- a/tower-balance/src/pool/mod.rs +++ b/tower-balance/src/pool/mod.rs @@ -73,7 +73,7 @@ where type Error = MS::MakeError; fn poll_discover( - mut self: Pin<&mut Self>, + self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll, Self::Error>> { let mut this = self.project(); @@ -339,8 +339,7 @@ where // update ewma with a 0 sample self.ewma = (1.0 - self.options.alpha) * self.ewma; - let mut discover = self.balance.discover_mut().as_mut(); - let discover = discover.project(); + let discover = self.balance.discover_mut().as_mut().project(); if self.ewma < self.options.low { if *discover.load != Level::Low { tracing::trace!({ ewma = %self.ewma }, "pool is over-provisioned"); @@ -361,8 +360,7 @@ where return Poll::Ready(Ok(())); } - let mut discover = self.balance.discover_mut().as_mut(); - let discover = discover.project(); + let discover = self.balance.discover_mut().as_mut().project(); if discover.making.is_none() { // no services are ready -- we're overloaded // update ewma with a 1 sample diff --git a/tower-buffer/Cargo.toml b/tower-buffer/Cargo.toml index 47218217c..6d10da3ef 100644 --- a/tower-buffer/Cargo.toml +++ b/tower-buffer/Cargo.toml @@ -27,7 +27,7 @@ default = ["log"] [dependencies] futures-core-preview = "=0.3.0-alpha.18" -pin-project = { version = "=0.4.0-alpha.11", features = ["project_attr"] } +pin-project = "0.4" tower-service = "=0.3.0-alpha.1" tower-layer = { version = "=0.3.0-alpha.1", path = "../tower-layer" } tokio-executor = "=0.2.0-alpha.5" diff --git a/tower-buffer/src/future.rs b/tower-buffer/src/future.rs index 00b7bc18d..1f0a25fc9 100644 --- a/tower-buffer/src/future.rs +++ b/tower-buffer/src/future.rs @@ -48,12 +48,12 @@ where type Output = Result; #[project] - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let mut this = self.project(); loop { #[project] - match this.state.project() { + match this.state.as_mut().project() { ResponseState::Failed(e) => { return Poll::Ready(Err(e.take().expect("polled after error"))); } diff --git a/tower-discover/Cargo.toml b/tower-discover/Cargo.toml index a66d8193a..636e7a276 100644 --- a/tower-discover/Cargo.toml +++ b/tower-discover/Cargo.toml @@ -24,4 +24,4 @@ edition = "2018" [dependencies] futures-core-preview = "=0.3.0-alpha.18" tower-service = "=0.3.0-alpha.1" -pin-project = "=0.4.0-alpha.11" +pin-project = "0.4" diff --git a/tower-discover/src/list.rs b/tower-discover/src/list.rs index 1e3b743f5..c647a9f81 100644 --- a/tower-discover/src/list.rs +++ b/tower-discover/src/list.rs @@ -42,7 +42,7 @@ where type Error = Never; fn poll_discover( - mut self: Pin<&mut Self>, + self: Pin<&mut Self>, _: &mut Context<'_>, ) -> Poll, Self::Error>> { match self.project().inner.next() { diff --git a/tower-discover/src/stream.rs b/tower-discover/src/stream.rs index 4f7a2c0cb..9ab555c72 100644 --- a/tower-discover/src/stream.rs +++ b/tower-discover/src/stream.rs @@ -36,7 +36,7 @@ where type Error = S::Error; fn poll_discover( - mut self: Pin<&mut Self>, + self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll, Self::Error>> { match ready!(self.project().inner.try_poll_next(cx)).transpose()? { diff --git a/tower-filter/Cargo.toml b/tower-filter/Cargo.toml index 6b00c6163..574de61e5 100644 --- a/tower-filter/Cargo.toml +++ b/tower-filter/Cargo.toml @@ -26,7 +26,7 @@ publish = false [dependencies] tower-service = "=0.3.0-alpha.1" tower-layer = { version = "=0.3.0-alpha.1", path = "../tower-layer" } -pin-project = { version = "=0.4.0-alpha.11", features = ["project_attr"] } +pin-project = "0.4" futures-core-preview = "=0.3.0-alpha.18" [dev-dependencies] diff --git a/tower-filter/src/future.rs b/tower-filter/src/future.rs index cbaa2c0a0..31a9655e7 100644 --- a/tower-filter/src/future.rs +++ b/tower-filter/src/future.rs @@ -60,12 +60,12 @@ where type Output = Result; #[project] - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let mut this = self.project(); loop { #[project] - match this.state.project() { + match this.state.as_mut().project() { State::Check(request) => { let request = request .take() diff --git a/tower-hedge/Cargo.toml b/tower-hedge/Cargo.toml index 64caa39d3..e61af46b5 100644 --- a/tower-hedge/Cargo.toml +++ b/tower-hedge/Cargo.toml @@ -12,7 +12,7 @@ tower-service = "0.3.0-alpha.1" tower-filter = { version = "0.3.0-alpha.1", path = "../tower-filter" } tokio-timer = "0.3.0-alpha.4" futures-util-preview = "0.3.0-alpha.18" -pin-project = "0.4.0-alpha.10" +pin-project = "0.4" [dev-dependencies] tower-test = { version = "0.3.0-alpha.1", path = "../tower-test" } diff --git a/tower-hedge/src/delay.rs b/tower-hedge/src/delay.rs index e94691f41..a26df92be 100644 --- a/tower-hedge/src/delay.rs +++ b/tower-hedge/src/delay.rs @@ -85,12 +85,12 @@ where type Output = Result; #[project] - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let mut this = self.project(); loop { #[project] - match this.state.project() { + match this.state.as_mut().project() { State::Delaying(delay, req) => { ready!(delay.poll(cx)); let req = req.take().expect("Missing request in delay"); diff --git a/tower-hedge/src/latency.rs b/tower-hedge/src/latency.rs index 20065b6f2..2a9ef7cd0 100644 --- a/tower-hedge/src/latency.rs +++ b/tower-hedge/src/latency.rs @@ -77,7 +77,7 @@ where { type Output = Result; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.project(); let rsp = ready!(this.inner.poll(cx))?; diff --git a/tower-hedge/src/lib.rs b/tower-hedge/src/lib.rs index c95638bc5..8fdc1054c 100644 --- a/tower-hedge/src/lib.rs +++ b/tower-hedge/src/lib.rs @@ -189,7 +189,7 @@ where { type Output = Result; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { self.project().inner.poll(cx).map_err(Into::into) } } diff --git a/tower-hedge/src/select.rs b/tower-hedge/src/select.rs index 54d6f09e6..c53066d4b 100644 --- a/tower-hedge/src/select.rs +++ b/tower-hedge/src/select.rs @@ -88,7 +88,7 @@ where { type Output = Result; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.project(); if let Poll::Ready(r) = this.a_fut.poll(cx) { diff --git a/tower-limit/Cargo.toml b/tower-limit/Cargo.toml index ae3111a09..6442bb7e2 100644 --- a/tower-limit/Cargo.toml +++ b/tower-limit/Cargo.toml @@ -27,7 +27,7 @@ tower-service = "=0.3.0-alpha.1" tower-layer = { version = "=0.3.0-alpha.1", path = "../tower-layer" } tokio-sync = "=0.2.0-alpha.5" tokio-timer = "=0.3.0-alpha.5" -pin-project = "=0.4.0-alpha.11" +pin-project = "0.4" [dev-dependencies] tower-test = { version = "=0.3.0-alpha.1", path = "../tower-test" } diff --git a/tower-limit/src/concurrency/future.rs b/tower-limit/src/concurrency/future.rs index 2d8cc3c46..171947e00 100644 --- a/tower-limit/src/concurrency/future.rs +++ b/tower-limit/src/concurrency/future.rs @@ -33,14 +33,14 @@ where { type Output = Result; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { Poll::Ready(ready!(self.project().inner.poll(cx)).map_err(Into::into)) } } #[pinned_drop] impl PinnedDrop for ResponseFuture { - fn drop(mut self: Pin<&mut Self>) { + fn drop(self: Pin<&mut Self>) { self.project().semaphore.add_permits(1); } } diff --git a/tower-limit/src/rate/future.rs b/tower-limit/src/rate/future.rs index 3b01f1d71..9810cf667 100644 --- a/tower-limit/src/rate/future.rs +++ b/tower-limit/src/rate/future.rs @@ -30,7 +30,7 @@ where { type Output = Result; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { Poll::Ready(Ok(ready!(self.project().inner.poll(cx))?)) } } diff --git a/tower-load-shed/Cargo.toml b/tower-load-shed/Cargo.toml index c0cfdcf47..9e94c05f7 100644 --- a/tower-load-shed/Cargo.toml +++ b/tower-load-shed/Cargo.toml @@ -25,7 +25,7 @@ edition = "2018" [dependencies] tower-service = "=0.3.0-alpha.1" tower-layer = { version = "=0.3.0-alpha.1", path = "../tower-layer" } -pin-project = { version = "=0.4.0-alpha.11", features = ["project_attr"] } +pin-project = "0.4" futures-core-preview = "=0.3.0-alpha.18" [dev-dependencies] diff --git a/tower-load-shed/src/future.rs b/tower-load-shed/src/future.rs index ee14d6575..331c495f2 100644 --- a/tower-load-shed/src/future.rs +++ b/tower-load-shed/src/future.rs @@ -45,11 +45,9 @@ where type Output = Result; #[project] - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - let mut this = self.project(); - + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { #[project] - match this.state.project() { + match self.project().state.project() { ResponseState::Called(fut) => Poll::Ready(ready!(fut.poll(cx)).map_err(Into::into)), ResponseState::Overloaded => Poll::Ready(Err(Overloaded::new().into())), } diff --git a/tower-load/Cargo.toml b/tower-load/Cargo.toml index 536fa4f55..164ad5ef5 100644 --- a/tower-load/Cargo.toml +++ b/tower-load/Cargo.toml @@ -27,7 +27,7 @@ log = "0.4.1" tokio-timer = "=0.3.0-alpha.5" tower-service = "=0.3.0-alpha.1" tower-discover = { version = "=0.3.0-alpha.1", path = "../tower-discover" } -pin-project = "=0.4.0-alpha.11" +pin-project = "0.4" [dev-dependencies] tokio-test = "=0.2.0-alpha.5" diff --git a/tower-load/src/constant.rs b/tower-load/src/constant.rs index 7777f8c71..2481166c6 100644 --- a/tower-load/src/constant.rs +++ b/tower-load/src/constant.rs @@ -62,7 +62,7 @@ impl Discover for Constant { /// Yields the next discovery change set. fn poll_discover( - mut self: Pin<&mut Self>, + self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll, D::Error>> { use self::Change::*; diff --git a/tower-load/src/instrument.rs b/tower-load/src/instrument.rs index 88486f477..f9a0b9ac0 100644 --- a/tower-load/src/instrument.rs +++ b/tower-load/src/instrument.rs @@ -66,7 +66,7 @@ where { type Output = Result; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.project(); let rsp = ready!(this.future.poll(cx))?; let h = this.handle.take().expect("handle"); diff --git a/tower-load/src/peak_ewma.rs b/tower-load/src/peak_ewma.rs index d34a28906..58c5bbe29 100644 --- a/tower-load/src/peak_ewma.rs +++ b/tower-load/src/peak_ewma.rs @@ -116,7 +116,7 @@ where type Error = D::Error; fn poll_discover( - mut self: Pin<&mut Self>, + self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll, D::Error>> { let this = self.project(); diff --git a/tower-load/src/pending_requests.rs b/tower-load/src/pending_requests.rs index d21f494d4..5c7606c8e 100644 --- a/tower-load/src/pending_requests.rs +++ b/tower-load/src/pending_requests.rs @@ -117,7 +117,7 @@ where /// Yields the next discovery change set. fn poll_discover( - mut self: Pin<&mut Self>, + self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll, D::Error>> { use self::Change::*; diff --git a/tower-reconnect/Cargo.toml b/tower-reconnect/Cargo.toml index 7efa9a5b0..32cb66d65 100644 --- a/tower-reconnect/Cargo.toml +++ b/tower-reconnect/Cargo.toml @@ -25,4 +25,4 @@ edition = "2018" log = "0.4.1" tower-service = "=0.3.0-alpha.1" tower-make = { version = "=0.3.0-alpha.2", path = "../tower-make" } -pin-project = "=0.4.0-alpha.11" +pin-project = "0.4" diff --git a/tower-reconnect/src/future.rs b/tower-reconnect/src/future.rs index 719dbfac1..f683cf1b1 100644 --- a/tower-reconnect/src/future.rs +++ b/tower-reconnect/src/future.rs @@ -25,7 +25,7 @@ where { type Output = Result; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { self.project().inner.poll(cx).map_err(Into::into) } } diff --git a/tower-retry/Cargo.toml b/tower-retry/Cargo.toml index 35c87f7e4..b2fb33932 100644 --- a/tower-retry/Cargo.toml +++ b/tower-retry/Cargo.toml @@ -25,7 +25,7 @@ edition = "2018" tower-service = "=0.3.0-alpha.1" tower-layer = { version = "=0.3.0-alpha.1", path = "../tower-layer" } tokio-timer = "=0.3.0-alpha.5" -pin-project = { version = "=0.4.0-alpha.11", features = ["project_attr"] } +pin-project = "0.4" futures-core-preview = "=0.3.0-alpha.18" [dev-dependencies] diff --git a/tower-retry/src/future.rs b/tower-retry/src/future.rs index 292542cf5..a60a85b1f 100644 --- a/tower-retry/src/future.rs +++ b/tower-retry/src/future.rs @@ -8,10 +8,6 @@ use std::pin::Pin; use std::task::{Context, Poll}; use tower_service::Service; -// NOTE: this is the trait generated for Ready::project() by pin-project. -// We need it here to be able to go "through" Ready to &mut Service without adding Unpin bounds. -use crate::__RetryProjectionTrait; - /// The `Future` returned by a `Retry` service. #[pin_project] #[derive(Debug)] @@ -64,12 +60,12 @@ where type Output = Result; #[project] - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let mut this = self.project(); loop { #[project] - match this.state.project() { + match this.state.as_mut().project() { State::Called(future) => { let result = ready!(future.poll(cx)); if let Some(ref req) = this.request { @@ -85,7 +81,11 @@ where } } State::Checking(future) => { - this.retry.project().policy.set(ready!(future.poll(cx))); + this.retry + .as_mut() + .project() + .policy + .set(ready!(future.poll(cx))); this.state.set(State::Retrying); } State::Retrying => { @@ -100,14 +100,15 @@ where // we need to make that assumption to avoid adding an Unpin bound to the Policy // in Ready to make it Unpin so that we can get &mut Ready as needed to call // poll_ready on it. - ready!(this.retry.project().service.poll_ready(cx))?; + ready!(this.retry.as_mut().project().service.poll_ready(cx))?; let req = this .request .take() .expect("retrying requires cloned request"); *this.request = this.retry.policy.clone_request(&req); - this.state - .set(State::Called(this.retry.project().service.call(req))); + this.state.set(State::Called( + this.retry.as_mut().project().service.call(req), + )); } } } diff --git a/tower-spawn-ready/Cargo.toml b/tower-spawn-ready/Cargo.toml index 4184691b8..17c2b71b3 100644 --- a/tower-spawn-ready/Cargo.toml +++ b/tower-spawn-ready/Cargo.toml @@ -24,7 +24,7 @@ edition = "2018" [dependencies] futures-core-preview = "=0.3.0-alpha.18" futures-util-preview = "=0.3.0-alpha.18" -pin-project = "=0.4.0-alpha.11" +pin-project = "0.4" tower-service = "=0.3.0-alpha.1" tower-layer = { version = "=0.3.0-alpha.1", path = "../tower-layer" } tokio-executor = "=0.2.0-alpha.5" diff --git a/tower-spawn-ready/src/future.rs b/tower-spawn-ready/src/future.rs index fb3164175..b3fe1d4f0 100644 --- a/tower-spawn-ready/src/future.rs +++ b/tower-spawn-ready/src/future.rs @@ -65,7 +65,7 @@ where { type Output = (); - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.project(); if let Poll::Ready(_) = Pin::new(this.tx.as_mut().expect("illegal state")).poll_closed(cx) { diff --git a/tower-spawn-ready/src/make.rs b/tower-spawn-ready/src/make.rs index 3a50c0e7e..6e6f859dc 100644 --- a/tower-spawn-ready/src/make.rs +++ b/tower-spawn-ready/src/make.rs @@ -54,7 +54,7 @@ where { type Output = Result, E>; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.project(); let inner = ready!(this.inner.poll(cx))?; let svc = SpawnReady::new(inner); diff --git a/tower-test/Cargo.toml b/tower-test/Cargo.toml index ed8200d36..ae340e6e6 100644 --- a/tower-test/Cargo.toml +++ b/tower-test/Cargo.toml @@ -27,4 +27,4 @@ futures-executor-preview = "=0.3.0-alpha.18" tokio-test = "=0.2.0-alpha.5" tokio-sync = "=0.2.0-alpha.5" tower-service = "=0.3.0-alpha.1" -pin-project = "=0.4.0-alpha.11" +pin-project = "0.4" diff --git a/tower-test/src/mock/future.rs b/tower-test/src/mock/future.rs index 4517f63e9..358c75a14 100644 --- a/tower-test/src/mock/future.rs +++ b/tower-test/src/mock/future.rs @@ -34,7 +34,7 @@ impl ResponseFuture { impl Future for ResponseFuture { type Output = Result; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll { match self.project().rx.as_pin_mut() { Some(rx) => match ready!(rx.poll(cx)) { Ok(r) => Poll::Ready(r), diff --git a/tower-timeout/Cargo.toml b/tower-timeout/Cargo.toml index 7253bce08..4e768e975 100644 --- a/tower-timeout/Cargo.toml +++ b/tower-timeout/Cargo.toml @@ -25,4 +25,4 @@ edition = "2018" tower-service = "=0.3.0-alpha.1" tower-layer = { version = "=0.3.0-alpha.1", path = "../tower-layer" } tokio-timer = "=0.3.0-alpha.5" -pin-project = "=0.4.0-alpha.11" +pin-project = "0.4" diff --git a/tower-timeout/src/future.rs b/tower-timeout/src/future.rs index a2e9b209e..77d066d43 100644 --- a/tower-timeout/src/future.rs +++ b/tower-timeout/src/future.rs @@ -32,7 +32,7 @@ where { type Output = Result; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.project(); // First, try polling the future diff --git a/tower-util/Cargo.toml b/tower-util/Cargo.toml index 5fb2ece2f..ea9f4b432 100644 --- a/tower-util/Cargo.toml +++ b/tower-util/Cargo.toml @@ -25,7 +25,7 @@ edition = "2018" [dependencies] tower-service = "=0.3.0-alpha.1" tower-layer = { version = "=0.3.0-alpha.1", path = "../tower-layer" } -pin-project = { version = "=0.4.0-alpha.11", features = ["project_attr"] } +pin-project = "0.4" futures-util-preview = "=0.3.0-alpha.18" futures-core-preview = "=0.3.0-alpha.18" diff --git a/tower-util/src/call_all/common.rs b/tower-util/src/call_all/common.rs index 8f1e33147..5269fec4b 100644 --- a/tower-util/src/call_all/common.rs +++ b/tower-util/src/call_all/common.rs @@ -50,7 +50,7 @@ where } /// Extract the wrapped `Service`. - pub(crate) fn take_service(mut self: Pin<&mut Self>) -> Svc { + pub(crate) fn take_service(self: Pin<&mut Self>) -> Svc { self.project() .service .take() @@ -73,7 +73,7 @@ where { type Item = Result; - fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { let mut this = self.project(); loop { diff --git a/tower-util/src/call_all/ordered.rs b/tower-util/src/call_all/ordered.rs index 87b7e84d7..e2f77801b 100644 --- a/tower-util/src/call_all/ordered.rs +++ b/tower-util/src/call_all/ordered.rs @@ -118,7 +118,7 @@ where /// # Panics /// /// Panics if `take_service` was already called. - pub fn take_service(mut self: Pin<&mut Self>) -> Svc { + pub fn take_service(self: Pin<&mut Self>) -> Svc { self.project().inner.take_service() } @@ -142,7 +142,7 @@ where { type Item = Result; - fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { self.project().inner.poll_next(cx) } } diff --git a/tower-util/src/call_all/unordered.rs b/tower-util/src/call_all/unordered.rs index 4b7be7ebc..8f65a8824 100644 --- a/tower-util/src/call_all/unordered.rs +++ b/tower-util/src/call_all/unordered.rs @@ -59,7 +59,7 @@ where /// # Panics /// /// Panics if `take_service` was already called. - pub fn take_service(mut self: Pin<&mut Self>) -> Svc { + pub fn take_service(self: Pin<&mut Self>) -> Svc { self.project().inner.take_service() } } @@ -72,7 +72,7 @@ where { type Item = Result; - fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { self.project().inner.poll_next(cx) } } diff --git a/tower-util/src/either.rs b/tower-util/src/either.rs index dcd3a5c41..ff16b6dc8 100644 --- a/tower-util/src/either.rs +++ b/tower-util/src/either.rs @@ -65,7 +65,7 @@ where type Output = Result; #[project] - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { #[project] match self.project() { Either::A(fut) => Poll::Ready(Ok(ready!(fut.poll(cx))?)), diff --git a/tower-util/src/oneshot.rs b/tower-util/src/oneshot.rs index d7d05f6e0..7523e2605 100644 --- a/tower-util/src/oneshot.rs +++ b/tower-util/src/oneshot.rs @@ -41,11 +41,11 @@ where type Output = Result; #[project] - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let mut this = self.project(); loop { #[project] - match this.state.project() { + match this.state.as_mut().project() { State::NotReady(nr) => { let (mut svc, req) = nr.take().expect("We immediately transition to ::Called"); let _ = ready!(svc.poll_ready(cx))?; diff --git a/tower-util/src/optional/future.rs b/tower-util/src/optional/future.rs index 25d5f4535..0b500cc1a 100644 --- a/tower-util/src/optional/future.rs +++ b/tower-util/src/optional/future.rs @@ -27,7 +27,7 @@ where { type Output = Result; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { match self.project().inner.as_pin_mut() { Some(inner) => Poll::Ready(Ok(ready!(inner.poll(cx))?)), None => Poll::Ready(Err(error::None::new().into())), diff --git a/tower-util/src/ready.rs b/tower-util/src/ready.rs index cc11628f5..4547f484b 100644 --- a/tower-util/src/ready.rs +++ b/tower-util/src/ready.rs @@ -36,7 +36,7 @@ where { type Output = Result<(), T::Error>; - fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let this = self.project(); ready!(this.inner.poll_ready(cx))?;