From 6c800755f332fb6c03d08fdd74926574e17ed81b Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 08:17:22 +0200 Subject: [PATCH 01/14] Actually check MSCV on CI --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e1c1e1608..6b951663d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -19,6 +19,7 @@ jobs: with: toolchain: ${{ matrix.rust }} profile: minimal + override: true - name: Check uses: actions-rs/cargo@v1 with: From efd5d6a4db0cc0f015dc1c9ff875ac34ff4c486a Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 08:26:04 +0200 Subject: [PATCH 02/14] check broken_intra_doc_links on CI --- .github/workflows/CI.yml | 15 +++++++++++++++ tower/src/lib.rs | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6b951663d..88bef246d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -26,6 +26,21 @@ jobs: command: check args: --all --all-targets --all-features + check-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + - name: cargo doc + working-directory: ${{ matrix.subcrate }} + env: + RUSTDOCFLAGS: "-D rustdoc::broken_intra_doc_links" + run: cargo doc --all-features --no-deps + cargo-hack: runs-on: ubuntu-latest steps: diff --git a/tower/src/lib.rs b/tower/src/lib.rs index 61ce3ac9b..68bb84186 100644 --- a/tower/src/lib.rs +++ b/tower/src/lib.rs @@ -5,10 +5,10 @@ rust_2018_idioms, unreachable_pub )] -#![deny(rustdoc::broken_intra_doc_links)] #![allow(elided_lifetimes_in_paths, clippy::type_complexity)] #![cfg_attr(test, allow(clippy::float_cmp))] #![cfg_attr(docsrs, feature(doc_cfg))] +// `rustdoc::broken_intra_doc_links` is checked on CI //! `async fn(Request) -> Result` //! From c6ca3bc4358499b3f4e93b0490b1b2bb267fee03 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 08:27:56 +0200 Subject: [PATCH 03/14] clean up CI --- .github/workflows/CI.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 88bef246d..3592a95e4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -8,7 +8,6 @@ on: jobs: check: - # Run `cargo check` first to ensure that the pushed code at least compiles. runs-on: ubuntu-latest strategy: matrix: @@ -76,7 +75,6 @@ jobs: args: --all --all-features style: - # Check style. needs: check runs-on: ubuntu-latest steps: @@ -91,22 +89,6 @@ jobs: with: command: fmt args: --all -- --check - - # warnings: - # # Check for any warnings. This is informational and thus is allowed to fail. - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@master - # - uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - # components: clippy - # profile: minimal - # - name: Clippy - # uses: actions-rs/clippy-check@v1 - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # args: --all --all-targets --all-features -- -D warnings deny-check: name: cargo-deny check From cd7efdf4694573f367836bf8d6802fccfc1ad180 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 08:30:17 +0200 Subject: [PATCH 04/14] fix other crates --- tower-layer/src/lib.rs | 2 +- tower-service/src/lib.rs | 2 +- tower-test/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tower-layer/src/lib.rs b/tower-layer/src/lib.rs index b664011d7..379955de5 100644 --- a/tower-layer/src/lib.rs +++ b/tower-layer/src/lib.rs @@ -5,7 +5,7 @@ rust_2018_idioms, unreachable_pub )] -#![deny(rustdoc::broken_intra_doc_links)] +// `rustdoc::broken_intra_doc_links` is checked on CI //! Layer traits and extensions. //! diff --git a/tower-service/src/lib.rs b/tower-service/src/lib.rs index 7bc9028e2..34e02a45e 100644 --- a/tower-service/src/lib.rs +++ b/tower-service/src/lib.rs @@ -5,7 +5,7 @@ rust_2018_idioms, unreachable_pub )] -#![deny(rustdoc::broken_intra_doc_links)] +// `rustdoc::broken_intra_doc_links` is checked on CI //! Definition of the core `Service` trait to Tower //! diff --git a/tower-test/src/lib.rs b/tower-test/src/lib.rs index 1f5869869..5fe841a6b 100644 --- a/tower-test/src/lib.rs +++ b/tower-test/src/lib.rs @@ -6,7 +6,7 @@ unreachable_pub )] #![allow(elided_lifetimes_in_paths)] -#![deny(rustdoc::broken_intra_doc_links)] +// `rustdoc::broken_intra_doc_links` is checked on CI //! Mock `Service` that can be used in tests. From 63bf66df27f65ff7df3b4bf0bd0d127e44a424bf Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 08:36:02 +0200 Subject: [PATCH 05/14] bump MSRV to 1.42 because of tracing-core --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3592a95e4..d7282bb85 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - rust: [stable, 1.40.0] + rust: [stable, 1.42.0] steps: - uses: actions/checkout@master - uses: actions-rs/toolchain@v1 From f8b399ddd840ce099aa1dd470f172563d7d8e290 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 08:47:34 +0200 Subject: [PATCH 06/14] attempt to fix http not working on 1.42 --- tower-service/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tower-service/Cargo.toml b/tower-service/Cargo.toml index 2e79971eb..b552b900e 100644 --- a/tower-service/Cargo.toml +++ b/tower-service/Cargo.toml @@ -24,7 +24,7 @@ edition = "2018" [dependencies] [dev-dependencies] -http = "0.2" +http = "0.2.4" tower-layer = { version = "0.3", path = "../tower-layer" } tokio = { version = "1" } futures = "0.3" From caa21f19f0a0d0cdacd0ae092b001abbdf30db45 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 08:58:51 +0200 Subject: [PATCH 07/14] use `--workspace` instead of `--all` `--all` is deprecated --- .github/workflows/CI.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d7282bb85..f9429b25c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -23,7 +23,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: check - args: --all --all-targets --all-features + args: --workspace --all-features --all-targets check-docs: runs-on: ubuntu-latest @@ -53,7 +53,7 @@ jobs: curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin - name: cargo hack check working-directory: ${{ matrix.subcrate }} - run: cargo hack check --each-feature --no-dev-deps --all + run: cargo hack check --each-feature --no-dev-deps --workspace test-versions: # Test against the stable, beta, and nightly Rust toolchains on ubuntu-latest. @@ -72,7 +72,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - args: --all --all-features + args: --workspace --all-features style: needs: check @@ -88,7 +88,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: fmt - args: --all -- --check + args: --workspace -- --check deny-check: name: cargo-deny check From 208a4dea8355b4a24cd5bdbd7fb0fb6173af82e1 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 08:59:13 +0200 Subject: [PATCH 08/14] make tower-service build on 1.42 --- tower-service/Cargo.toml | 3 +-- tower-service/src/lib.rs | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tower-service/Cargo.toml b/tower-service/Cargo.toml index b552b900e..07cb1b7bb 100644 --- a/tower-service/Cargo.toml +++ b/tower-service/Cargo.toml @@ -24,7 +24,6 @@ edition = "2018" [dependencies] [dev-dependencies] -http = "0.2.4" tower-layer = { version = "0.3", path = "../tower-layer" } -tokio = { version = "1" } +tokio = { version = "1", features = ["macros", "time"] } futures = "0.3" diff --git a/tower-service/src/lib.rs b/tower-service/src/lib.rs index 34e02a45e..91c0b95ed 100644 --- a/tower-service/src/lib.rs +++ b/tower-service/src/lib.rs @@ -47,13 +47,30 @@ use std::task::{Context, Poll}; /// # use std::task::{Poll, Context}; /// # use std::future::Future; /// # use tower_service::Service; -/// use http::{Request, Response, StatusCode}; +/// # // we cannot use the `http` crate since its MSRV is higher than tower's +/// # // so we stub the APIs we need +/// # struct Request(T); +/// # struct Response(T); +/// # impl Response<()> { +/// # fn builder() -> Builder { +/// # Builder +/// # } +/// # } +/// # struct Builder; +/// # impl Builder { +/// # fn status(self, _: T) -> Self { self } +/// # fn body(self, body: T) -> Option> { Some(Response(body)) } +/// # } +/// # struct StatusCode; +/// # impl StatusCode { +/// # const OK: () = (); +/// # } /// /// struct HelloWorld; /// /// impl Service>> for HelloWorld { /// type Response = Response>; -/// type Error = http::Error; +/// type Error = Box; /// type Future = Pin>>>; /// /// fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { From 51e73e075b812953e22ac008893f192af9aaf299 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 09:05:20 +0200 Subject: [PATCH 09/14] force http version 0.2.4 --- tower-service/Cargo.toml | 1 + tower-service/src/lib.rs | 19 +------------------ tower/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/tower-service/Cargo.toml b/tower-service/Cargo.toml index 07cb1b7bb..bcd16ed04 100644 --- a/tower-service/Cargo.toml +++ b/tower-service/Cargo.toml @@ -27,3 +27,4 @@ edition = "2018" tower-layer = { version = "0.3", path = "../tower-layer" } tokio = { version = "1", features = ["macros", "time"] } futures = "0.3" +http = "=0.2.4" # 0.2.5 requires rust 1.46 for `const_if_match` diff --git a/tower-service/src/lib.rs b/tower-service/src/lib.rs index 91c0b95ed..ff420e1ec 100644 --- a/tower-service/src/lib.rs +++ b/tower-service/src/lib.rs @@ -47,24 +47,7 @@ use std::task::{Context, Poll}; /// # use std::task::{Poll, Context}; /// # use std::future::Future; /// # use tower_service::Service; -/// # // we cannot use the `http` crate since its MSRV is higher than tower's -/// # // so we stub the APIs we need -/// # struct Request(T); -/// # struct Response(T); -/// # impl Response<()> { -/// # fn builder() -> Builder { -/// # Builder -/// # } -/// # } -/// # struct Builder; -/// # impl Builder { -/// # fn status(self, _: T) -> Self { self } -/// # fn body(self, body: T) -> Option> { Some(Response(body)) } -/// # } -/// # struct StatusCode; -/// # impl StatusCode { -/// # const OK: () = (); -/// # } +/// use http::{Request, Response, StatusCode}; /// /// struct HelloWorld; /// diff --git a/tower/Cargo.toml b/tower/Cargo.toml index b9e9da818..4dced45a1 100644 --- a/tower/Cargo.toml +++ b/tower/Cargo.toml @@ -87,7 +87,7 @@ tokio-stream = "0.1" tokio-test = "0.4" tower-test = { version = "0.4", path = "../tower-test" } tracing-subscriber = "0.2.14" -http = "0.2" +http = "=0.2.4" # 0.2.5 requires rust 1.46 for `const_if_match` # env_logger = { version = "0.5.3", default-features = false } # log = "0.4.1" From 8fdc298df24b4c264ad54ba9b5cff4aa0c4fd269 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 09:11:54 +0200 Subject: [PATCH 10/14] actually msrv is 1.46 because of tokio --- .github/workflows/CI.yml | 2 +- README.md | 4 ++-- tower-service/Cargo.toml | 2 +- tower/Cargo.toml | 4 +--- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f9429b25c..2e6569b69 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - rust: [stable, 1.42.0] + rust: [stable, 1.46.0] steps: - uses: actions/checkout@master - uses: actions-rs/toolchain@v1 diff --git a/README.md b/README.md index cdc91c3d2..401d0de15 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ Tower aims to make it as easy as possible to build robust networking clients and servers. It is protocol agnostic, but is designed around a request / response pattern. If your protocol is entirely stream based, Tower may not be a good fit. -## Status +## Minimum supported Rust version -Currently, `tower 0.4` is released on crates.io. +tower's MSRV is 1.46. ## Getting Started diff --git a/tower-service/Cargo.toml b/tower-service/Cargo.toml index bcd16ed04..86e1fa701 100644 --- a/tower-service/Cargo.toml +++ b/tower-service/Cargo.toml @@ -27,4 +27,4 @@ edition = "2018" tower-layer = { version = "0.3", path = "../tower-layer" } tokio = { version = "1", features = ["macros", "time"] } futures = "0.3" -http = "=0.2.4" # 0.2.5 requires rust 1.46 for `const_if_match` +http = "0.2" diff --git a/tower/Cargo.toml b/tower/Cargo.toml index 4dced45a1..1ef95d83d 100644 --- a/tower/Cargo.toml +++ b/tower/Cargo.toml @@ -87,9 +87,7 @@ tokio-stream = "0.1" tokio-test = "0.4" tower-test = { version = "0.4", path = "../tower-test" } tracing-subscriber = "0.2.14" -http = "=0.2.4" # 0.2.5 requires rust 1.46 for `const_if_match` -# env_logger = { version = "0.5.3", default-features = false } -# log = "0.4.1" +http = "0.2" [package.metadata.docs.rs] all-features = true From 5b88d413895dc8e6bcafcfdcd0e7c5db5fd092a6 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 09:27:22 +0200 Subject: [PATCH 11/14] fix running `cargo fmt` --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2e6569b69..a33938afd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -88,7 +88,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: fmt - args: --workspace -- --check + args: --all -- --check deny-check: name: cargo-deny check From 5aabe0c679c259d49d5092d51b4a7e7114e2a848 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 09:28:38 +0200 Subject: [PATCH 12/14] clean up --- tower-service/Cargo.toml | 2 +- tower-service/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tower-service/Cargo.toml b/tower-service/Cargo.toml index 86e1fa701..8670a6922 100644 --- a/tower-service/Cargo.toml +++ b/tower-service/Cargo.toml @@ -24,7 +24,7 @@ edition = "2018" [dependencies] [dev-dependencies] +http = "0.2" tower-layer = { version = "0.3", path = "../tower-layer" } tokio = { version = "1", features = ["macros", "time"] } futures = "0.3" -http = "0.2" diff --git a/tower-service/src/lib.rs b/tower-service/src/lib.rs index ff420e1ec..34e02a45e 100644 --- a/tower-service/src/lib.rs +++ b/tower-service/src/lib.rs @@ -53,7 +53,7 @@ use std::task::{Context, Poll}; /// /// impl Service>> for HelloWorld { /// type Response = Response>; -/// type Error = Box; +/// type Error = http::Error; /// type Future = Pin>>>; /// /// fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { From 718b1c9bd299ab81213ff471e4ab8d6691427bdf Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Sun, 17 Oct 2021 09:33:16 +0200 Subject: [PATCH 13/14] also run tests on 1.46 --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a33938afd..3c211dcc1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -32,7 +32,6 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: stable - override: true profile: minimal - name: cargo doc working-directory: ${{ matrix.subcrate }} @@ -61,13 +60,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - rust: [stable, beta, nightly, 1.40.0] + rust: [stable, beta, nightly, 1.46.0] steps: - uses: actions/checkout@master - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.rust }} profile: minimal + override: true - name: Run tests uses: actions-rs/cargo@v1 with: From 19ccfd0df7a2a3dc39ee34785dea35c59c9c1dfb Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Tue, 19 Oct 2021 16:14:41 +0200 Subject: [PATCH 14/14] ignore rustsec in time --- deny.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deny.toml b/deny.toml index 6ec664ee9..1b996ad41 100644 --- a/deny.toml +++ b/deny.toml @@ -2,7 +2,7 @@ vulnerability = "deny" unmaintained = "warn" notice = "warn" -ignore = [] +ignore = ["RUSTSEC-2020-0159"] [licenses] unlicensed = "deny"