Skip to content

Commit

Permalink
Update pin-project to 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Sep 26, 2019
1 parent d5b36b5 commit 963c3f5
Show file tree
Hide file tree
Showing 48 changed files with 90 additions and 70 deletions.
12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
11 changes: 11 additions & 0 deletions ci/patch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion tower-balance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tower-balance/examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Result<Change<Self::Key, Self::Service>, Self::Error>> {
match self.project().0.pop() {
Expand Down
2 changes: 1 addition & 1 deletion tower-balance/src/p2c/make.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ where
{
type Output = Result<Balance<T, Req>, E>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = self.project();
let inner = ready!(this.inner.poll(cx))?;
let svc = Balance::new(inner, this.rng.clone());
Expand Down
2 changes: 1 addition & 1 deletion tower-balance/src/p2c/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ where
impl<K, S: Service<Req>, Req> Future for UnreadyService<K, S, Req> {
type Output = Result<(K, S), (K, Error<S::Error>)>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = self.project();

if let Poll::Ready(Ok(())) = this.cancel.poll(cx) {
Expand Down
8 changes: 3 additions & 5 deletions tower-balance/src/pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ where
type Error = MS::MakeError;

fn poll_discover(
mut self: Pin<&mut Self>,
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Change<Self::Key, Self::Service>, Self::Error>> {
let mut this = self.project();
Expand Down Expand Up @@ -374,8 +374,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");
Expand All @@ -396,8 +395,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
Expand Down
2 changes: 1 addition & 1 deletion tower-buffer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions tower-buffer/src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ where
type Output = Result<T, Error>;

#[project]
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
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")));
}
Expand Down
2 changes: 1 addition & 1 deletion tower-discover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion tower-discover/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ where
type Error = Never;

fn poll_discover(
mut self: Pin<&mut Self>,
self: Pin<&mut Self>,
_: &mut Context<'_>,
) -> Poll<Result<Change<Self::Key, Self::Service>, Self::Error>> {
match self.project().inner.next() {
Expand Down
2 changes: 1 addition & 1 deletion tower-discover/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ where
type Error = S::Error;

fn poll_discover(
mut self: Pin<&mut Self>,
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Change<Self::Key, Self::Service>, Self::Error>> {
match ready!(self.project().inner.try_poll_next(cx)).transpose()? {
Expand Down
2 changes: 1 addition & 1 deletion tower-filter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions tower-filter/src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ where
type Output = Result<S::Response, Error>;

#[project]
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let mut this = self.project();

loop {
#[project]
match this.state.project() {
match this.state.as_mut().project() {
State::Check(request) => {
let request = request
.take()
Expand Down
2 changes: 1 addition & 1 deletion tower-hedge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
4 changes: 2 additions & 2 deletions tower-hedge/src/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ where
type Output = Result<T, super::Error>;

#[project]
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
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");
Expand Down
2 changes: 1 addition & 1 deletion tower-hedge/src/latency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ where
{
type Output = Result<T, super::Error>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = self.project();

let rsp = ready!(this.inner.poll(cx))?;
Expand Down
2 changes: 1 addition & 1 deletion tower-hedge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ where
{
type Output = Result<S::Response, Error>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
self.project().inner.poll(cx).map_err(Into::into)
}
}
Expand Down
2 changes: 1 addition & 1 deletion tower-hedge/src/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ where
{
type Output = Result<T, super::Error>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = self.project();

if let Poll::Ready(r) = this.a_fut.poll(cx) {
Expand Down
2 changes: 1 addition & 1 deletion tower-limit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
4 changes: 2 additions & 2 deletions tower-limit/src/concurrency/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ where
{
type Output = Result<T, Error>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
Poll::Ready(ready!(self.project().inner.poll(cx)).map_err(Into::into))
}
}

#[pinned_drop]
impl<T> PinnedDrop for ResponseFuture<T> {
fn drop(mut self: Pin<&mut Self>) {
fn drop(self: Pin<&mut Self>) {
self.project().semaphore.add_permits(1);
}
}
2 changes: 1 addition & 1 deletion tower-limit/src/rate/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ where
{
type Output = Result<T, Error>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
Poll::Ready(Ok(ready!(self.project().inner.poll(cx))?))
}
}
2 changes: 1 addition & 1 deletion tower-load-shed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 2 additions & 4 deletions tower-load-shed/src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ where
type Output = Result<T, Error>;

#[project]
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let mut this = self.project();

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
#[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())),
}
Expand Down
2 changes: 1 addition & 1 deletion tower-load/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tower-load/src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<D: Discover + Unpin, M: Copy> Discover for Constant<D, M> {

/// Yields the next discovery change set.
fn poll_discover(
mut self: Pin<&mut Self>,
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Change<D::Key, Self::Service>, D::Error>> {
use self::Change::*;
Expand Down
2 changes: 1 addition & 1 deletion tower-load/src/instrument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ where
{
type Output = Result<I::Output, E>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = self.project();
let rsp = ready!(this.future.poll(cx))?;
let h = this.handle.take().expect("handle");
Expand Down
2 changes: 1 addition & 1 deletion tower-load/src/peak_ewma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ where
type Error = D::Error;

fn poll_discover(
mut self: Pin<&mut Self>,
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Change<D::Key, Self::Service>, D::Error>> {
let this = self.project();
Expand Down
2 changes: 1 addition & 1 deletion tower-load/src/pending_requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Result<Change<D::Key, Self::Service>, D::Error>> {
use self::Change::*;
Expand Down
2 changes: 1 addition & 1 deletion tower-reconnect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion tower-reconnect/src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ where
{
type Output = Result<T, Error>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
self.project().inner.poll(cx).map_err(Into::into)
}
}
2 changes: 1 addition & 1 deletion tower-retry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading

0 comments on commit 963c3f5

Please sign in to comment.