From 2ef021d1c9e587abe35ad893c9ad4a6c0cd808a2 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 13 Sep 2022 21:10:34 +0900 Subject: [PATCH 1/7] ci: use install-action to reduce installation time --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbc350feab9..b235c5dfd6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,7 @@ jobs: run: rustup update stable - uses: Swatinem/rust-cache@v1 - name: Install cargo-hack - run: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack # Run `tokio` with `full` features. This excludes testing utilities which # can alter the runtime behavior of Tokio. @@ -278,7 +278,7 @@ jobs: override: true - uses: Swatinem/rust-cache@v1 - name: Install cargo-hack - run: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack - name: check --each-feature run: cargo hack check --all --each-feature -Z avoid-dev-deps - name: check net,time @@ -315,7 +315,7 @@ jobs: override: true - uses: Swatinem/rust-cache@v1 - name: Install cargo-hack - run: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack - name: "check --all-features -Z minimal-versions" run: | # Remove dev-dependencies from Cargo.toml to prevent the next `cargo update` @@ -483,13 +483,13 @@ jobs: # Install dependencies - name: Install cargo-hack - run: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack - name: Install wasm32-wasi target run: rustup target add wasm32-wasi - name: Install wasmtime - run: cargo install wasmtime-cli + uses: taiki-e/install-action@wasmtime - name: Install cargo-wasi run: cargo install cargo-wasi @@ -539,4 +539,3 @@ jobs: cargo install cargo-check-external-types --locked --version 0.1.3 cargo check-external-types --all-features --config external-types.toml working-directory: tokio - From 2a28ab493999c94822f2b2965da19524ed093658 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 13 Sep 2022 21:10:37 +0900 Subject: [PATCH 2/7] ci: use --feature-powerset --depth 2 in features check --- .github/workflows/ci.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b235c5dfd6e..a5308ad17b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -279,13 +279,11 @@ jobs: - uses: Swatinem/rust-cache@v1 - name: Install cargo-hack uses: taiki-e/install-action@cargo-hack - - name: check --each-feature - run: cargo hack check --all --each-feature -Z avoid-dev-deps - - name: check net,time - run: cargo check -p tokio --no-default-features --features net,time -Z avoid-dev-deps + - name: check --feature-powerset + run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps # Try with unstable feature flags - - name: check --each-feature --unstable - run: cargo hack check --all --each-feature -Z avoid-dev-deps + - name: check --feature-powerset --unstable + run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps env: RUSTFLAGS: --cfg tokio_unstable -Dwarnings From 33fc19371a68dc1424ceed7dc32bfe6c737e5c09 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 13 Sep 2022 21:22:48 +0900 Subject: [PATCH 3/7] fix dead-code on --features net,rt ``` info: running `cargo check -Z avoid-dev-deps --no-default-features --features net,rt` on tokio (38/225) Compiling tokio v1.21.1 (/home/runner/work/tokio/tokio/tokio) error: associated function `shutdown` is never used --> tokio/src/runtime/driver.rs:65:23 | 65 | pub(crate) fn shutdown(&mut self) { | ^^^^^^^^ | = note: `-D dead-code` implied by `-D warnings` ``` --- tokio/src/runtime/driver.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tokio/src/runtime/driver.rs b/tokio/src/runtime/driver.rs index 172de7061fd..abce23aa623 100644 --- a/tokio/src/runtime/driver.rs +++ b/tokio/src/runtime/driver.rs @@ -62,10 +62,12 @@ cfg_io_driver! { } } - pub(crate) fn shutdown(&mut self) { - match self { - IoStack::Enabled(v) => v.shutdown(), - IoStack::Disabled(v) => v.shutdown(), + cfg_rt_multi_thread! { + pub(crate) fn shutdown(&mut self) { + match self { + IoStack::Enabled(v) => v.shutdown(), + IoStack::Disabled(v) => v.shutdown(), + } } } } From 450e15c85da0aa2f19529131390d946f3cd03267 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 13 Sep 2022 21:24:30 +0900 Subject: [PATCH 4/7] [wip] add --keep-going --- .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 a5308ad17b7..2c861a0f4b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -280,10 +280,10 @@ jobs: - name: Install cargo-hack uses: taiki-e/install-action@cargo-hack - name: check --feature-powerset - run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps + run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps --keep-going # Try with unstable feature flags - name: check --feature-powerset --unstable - run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps + run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps --keep-going env: RUSTFLAGS: --cfg tokio_unstable -Dwarnings From 40f5447f9e1cce5a1f1b2438f76a033557c81b34 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 13 Sep 2022 21:31:36 +0900 Subject: [PATCH 5/7] Revert "fix dead-code on --features net,rt" This reverts commit 33fc19371a68dc1424ceed7dc32bfe6c737e5c09. --- tokio/src/runtime/driver.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tokio/src/runtime/driver.rs b/tokio/src/runtime/driver.rs index abce23aa623..172de7061fd 100644 --- a/tokio/src/runtime/driver.rs +++ b/tokio/src/runtime/driver.rs @@ -62,12 +62,10 @@ cfg_io_driver! { } } - cfg_rt_multi_thread! { - pub(crate) fn shutdown(&mut self) { - match self { - IoStack::Enabled(v) => v.shutdown(), - IoStack::Disabled(v) => v.shutdown(), - } + pub(crate) fn shutdown(&mut self) { + match self { + IoStack::Enabled(v) => v.shutdown(), + IoStack::Disabled(v) => v.shutdown(), } } } From c41b5b3a88666b65977f39b1fca5b51c7fcc93f9 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 13 Sep 2022 21:51:45 +0900 Subject: [PATCH 6/7] avoid dead-code warning, take 2 This warning happened in the following cases. ``` failed commands: tokio: `/home/runner/.rustup/toolchains/nightly-2022-07-26-x86_64-unknown-linux-gnu/bin/cargo check -Z avoid-dev-deps --manifest-path tokio/Cargo.toml --no-default-features --features net,rt` `/home/runner/.rustup/toolchains/nightly-2022-07-26-x86_64-unknown-linux-gnu/bin/cargo check -Z avoid-dev-deps --manifest-path tokio/Cargo.toml --no-default-features --features process,rt` `/home/runner/.rustup/toolchains/nightly-2022-07-26-x86_64-unknown-linux-gnu/bin/cargo check -Z avoid-dev-deps --manifest-path tokio/Cargo.toml --no-default-features --features rt,signal` `/home/runner/.rustup/toolchains/nightly-2022-07-26-x86_64-unknown-linux-gnu/bin/cargo check -Z avoid-dev-deps --manifest-path tokio/Cargo.toml --no-default-features --features rt-multi-thread,signal` `/home/runner/.rustup/toolchains/nightly-2022-07-26-x86_64-unknown-linux-gnu/bin/cargo check -Z avoid-dev-deps --manifest-path tokio/Cargo.toml --no-default-features --features signal,test-util` tokio-util: `/home/runner/.rustup/toolchains/nightly-2022-07-26-x86_64-unknown-linux-gnu/bin/cargo check -Z avoid-dev-deps --manifest-path tokio-util/Cargo.toml --no-default-features --features io-util,net` `/home/runner/.rustup/toolchains/nightly-2022-07-26-x86_64-unknown-linux-gnu/bin/cargo check -Z avoid-dev-deps --manifest-path tokio-util/Cargo.toml --no-default-features --features net,rt` ``` --- tokio/src/runtime/driver.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tokio/src/runtime/driver.rs b/tokio/src/runtime/driver.rs index 172de7061fd..2a0deb801d2 100644 --- a/tokio/src/runtime/driver.rs +++ b/tokio/src/runtime/driver.rs @@ -62,6 +62,7 @@ cfg_io_driver! { } } + #[cfg_attr(not(feature = "rt-multi-thread"), allow(dead_code))] // some features use this pub(crate) fn shutdown(&mut self) { match self { IoStack::Enabled(v) => v.shutdown(), From 96e8b120e5d5fc279ad4a6e43f3f3c68dd66193d Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Tue, 13 Sep 2022 10:16:04 -0700 Subject: [PATCH 7/7] try to fix build --- tokio/src/process/unix/driver.rs | 4 ++-- tokio/src/runtime/driver.rs | 2 +- tokio/src/runtime/io/mod.rs | 8 ++------ tokio/src/signal/unix/driver.rs | 4 ++-- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tokio/src/process/unix/driver.rs b/tokio/src/process/unix/driver.rs index 2e1a36ade73..5f9fdddfd0b 100644 --- a/tokio/src/process/unix/driver.rs +++ b/tokio/src/process/unix/driver.rs @@ -28,8 +28,8 @@ impl Driver { } } - pub(crate) fn handle(&self) -> Handle { - self.park.io_handle() + pub(crate) fn unpark(&self) -> Handle { + self.park.unpark() } pub(crate) fn park(&mut self) { diff --git a/tokio/src/runtime/driver.rs b/tokio/src/runtime/driver.rs index 2a0deb801d2..ac9b1a9271b 100644 --- a/tokio/src/runtime/driver.rs +++ b/tokio/src/runtime/driver.rs @@ -43,7 +43,7 @@ cfg_io_driver! { impl IoStack { pub(crate) fn unpark(&self) -> IoUnpark { match self { - IoStack::Enabled(v) => IoUnpark::Enabled(v.handle()), + IoStack::Enabled(v) => IoUnpark::Enabled(v.unpark()), IoStack::Disabled(v) => IoUnpark::Disabled(v.unpark()), } } diff --git a/tokio/src/runtime/io/mod.rs b/tokio/src/runtime/io/mod.rs index ef335723b19..22d84cbb6e2 100644 --- a/tokio/src/runtime/io/mod.rs +++ b/tokio/src/runtime/io/mod.rs @@ -145,12 +145,8 @@ impl Driver { } // TODO: remove this in a later refactor - cfg_not_rt! { - cfg_time! { - pub(crate) fn unpark(&self) -> Handle { - self.handle() - } - } + pub(crate) fn unpark(&self) -> Handle { + self.handle() } pub(crate) fn park(&mut self) { diff --git a/tokio/src/signal/unix/driver.rs b/tokio/src/signal/unix/driver.rs index e30519350af..6192c807303 100644 --- a/tokio/src/signal/unix/driver.rs +++ b/tokio/src/signal/unix/driver.rs @@ -92,8 +92,8 @@ impl Driver { } } - pub(crate) fn io_handle(&self) -> io::Handle { - self.park.handle() + pub(crate) fn unpark(&self) -> io::Handle { + self.park.unpark() } pub(crate) fn park(&mut self) {