From b8d81496b889db7a3750c22f1b10c515cf8dbe06 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 14:24:10 +0200 Subject: [PATCH 01/22] Silence unexpected-cfgs warnings --- tokio-macros/src/lib.rs | 1 + tokio-stream/src/lib.rs | 1 + tokio-test/src/lib.rs | 1 + tokio-util/src/lib.rs | 1 + tokio/src/lib.rs | 1 + 5 files changed, 5 insertions(+) diff --git a/tokio-macros/src/lib.rs b/tokio-macros/src/lib.rs index ab7b083d381..c108d8c46a2 100644 --- a/tokio-macros/src/lib.rs +++ b/tokio-macros/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![allow(clippy::needless_doctest_main)] #![warn( missing_debug_implementations, diff --git a/tokio-stream/src/lib.rs b/tokio-stream/src/lib.rs index 6ff1085a552..11ccd8c6aee 100644 --- a/tokio-stream/src/lib.rs +++ b/tokio-stream/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![allow( clippy::cognitive_complexity, clippy::large_enum_variant, diff --git a/tokio-test/src/lib.rs b/tokio-test/src/lib.rs index 87e63861210..9f60faf7952 100644 --- a/tokio-test/src/lib.rs +++ b/tokio-test/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![warn( missing_debug_implementations, missing_docs, diff --git a/tokio-util/src/lib.rs b/tokio-util/src/lib.rs index 1df4de1b459..34f69fd14e3 100644 --- a/tokio-util/src/lib.rs +++ b/tokio-util/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![allow(clippy::needless_doctest_main)] #![warn( missing_debug_implementations, diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 52b098986fb..ea52b7e8a52 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![allow( clippy::cognitive_complexity, clippy::large_enum_variant, From 981f684a5cf0e9c4eaab065e8a908d6361ceeacc Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 14:32:23 +0200 Subject: [PATCH 02/22] Update nightly CI version --- .cirrus.yml | 2 +- .github/workflows/ci.yml | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 8aea3efa74b..bdf3af74098 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -4,7 +4,7 @@ freebsd_instance: image_family: freebsd-14-0 env: RUST_STABLE: stable - RUST_NIGHTLY: nightly-2023-10-21 + RUST_NIGHTLY: nightly-2024-05-05 RUSTFLAGS: -D warnings # Test FreeBSD in a full VM on cirrus-ci.com. Test the i686 target too, in the diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f5e9004959..0ee3f6ed189 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ env: RUST_BACKTRACE: 1 # Change to specific Rust release to pin rust_stable: stable - rust_nightly: nightly-2023-10-21 + rust_nightly: nightly-2024-05-05 rust_clippy: '1.77' # When updating this, also update: # - README.md @@ -995,6 +995,21 @@ jobs: run: cargo check-external-types --all-features working-directory: tokio + check-unexpected-lints-cfgs: + name: check unexpected lints and cfgs + needs: basics + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust ${{ env.rust_nightly }} + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.rust_nightly }} + - name: check tokio + run: cargo check --all-features + env: + RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom) --check-cfg=cfg(tokio_unstable) -Funexpected_cfgs -Funknown_lints + check-fuzzing: name: check-fuzzing needs: basics From 1c52ebc19094947a8225d86d21d92dd79c7f4b02 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 14:38:09 +0200 Subject: [PATCH 03/22] Delete allow lines in CI step --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ee3f6ed189..103a0af9f87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1005,6 +1005,8 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.rust_nightly }} + - name: don't allow warnings + run: sed -i '/#!\[allow(unknown_lints, unexpected_cfgs)\]/d' */src/lib.rs - name: check tokio run: cargo check --all-features env: From df06640dfedd8c11432ad9d672024f5f5b615a22 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 14:46:35 +0200 Subject: [PATCH 04/22] Allow --cfg tokio_taskdump --- .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 103a0af9f87..b8d364f2b80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1010,7 +1010,7 @@ jobs: - name: check tokio run: cargo check --all-features env: - RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom) --check-cfg=cfg(tokio_unstable) -Funexpected_cfgs -Funknown_lints + RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom) --check-cfg=cfg(tokio_unstable) --check-cfg=cfg(tokio_taskdump) -Funexpected_cfgs -Funknown_lints check-fuzzing: name: check-fuzzing From b35d19916bfa9f52952ac92b847e1d817b10a35b Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 14:49:23 +0200 Subject: [PATCH 05/22] Also ignore lints in tests --- .github/workflows/ci.yml | 6 +++--- tokio-util/tests/task_join_map.rs | 1 + tokio/tests/dump.rs | 1 + tokio/tests/macros_select.rs | 1 + tokio/tests/rt_basic.rs | 1 + tokio/tests/rt_common.rs | 1 + tokio/tests/rt_handle.rs | 1 + tokio/tests/rt_metrics.rs | 1 + tokio/tests/rt_threaded.rs | 1 + tokio/tests/rt_threaded_alt.rs | 1 + tokio/tests/task_builder.rs | 2 ++ tokio/tests/task_id.rs | 1 + tokio/tests/task_join_set.rs | 1 + tokio/tests/task_local_set.rs | 1 + tokio/tests/task_yield_now.rs | 1 + 15 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8d364f2b80..9f9a8b902e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1006,9 +1006,9 @@ jobs: with: toolchain: ${{ env.rust_nightly }} - name: don't allow warnings - run: sed -i '/#!\[allow(unknown_lints, unexpected_cfgs)\]/d' */src/lib.rs - - name: check tokio - run: cargo check --all-features + run: sed -i '/#!\[allow(unknown_lints, unexpected_cfgs)\]/d' */src/lib.rs */tests/*.rs + - name: check for unknown lints and cfgs + run: cargo check --all-features --tests env: RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom) --check-cfg=cfg(tokio_unstable) --check-cfg=cfg(tokio_taskdump) -Funexpected_cfgs -Funknown_lints diff --git a/tokio-util/tests/task_join_map.rs b/tokio-util/tests/task_join_map.rs index 1ab5f9ba832..8757f8b5c6e 100644 --- a/tokio-util/tests/task_join_map.rs +++ b/tokio-util/tests/task_join_map.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(feature = "rt", tokio_unstable))] diff --git a/tokio/tests/dump.rs b/tokio/tests/dump.rs index c946f38436c..68b53aaf291 100644 --- a/tokio/tests/dump.rs +++ b/tokio/tests/dump.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![cfg(all( tokio_unstable, tokio_taskdump, diff --git a/tokio/tests/macros_select.rs b/tokio/tests/macros_select.rs index f65cbdf2267..cbad971ab1f 100644 --- a/tokio/tests/macros_select.rs +++ b/tokio/tests/macros_select.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![cfg(feature = "macros")] #![allow(clippy::disallowed_names)] diff --git a/tokio/tests/rt_basic.rs b/tokio/tests/rt_basic.rs index 47bf2dfdc12..a5204bd83f7 100644 --- a/tokio/tests/rt_basic.rs +++ b/tokio/tests/rt_basic.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] diff --git a/tokio/tests/rt_common.rs b/tokio/tests/rt_common.rs index a71fc4a735e..75a20057166 100644 --- a/tokio/tests/rt_common.rs +++ b/tokio/tests/rt_common.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![allow(clippy::needless_range_loop)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] diff --git a/tokio/tests/rt_handle.rs b/tokio/tests/rt_handle.rs index 92fa777e321..9efe9b4bde9 100644 --- a/tokio/tests/rt_handle.rs +++ b/tokio/tests/rt_handle.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] diff --git a/tokio/tests/rt_metrics.rs b/tokio/tests/rt_metrics.rs index 4dfed06fed4..58869c530ae 100644 --- a/tokio/tests/rt_metrics.rs +++ b/tokio/tests/rt_metrics.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", tokio_unstable, not(target_os = "wasi")))] diff --git a/tokio/tests/rt_threaded.rs b/tokio/tests/rt_threaded.rs index 6e769fc831f..26690550f93 100644 --- a/tokio/tests/rt_threaded.rs +++ b/tokio/tests/rt_threaded.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] diff --git a/tokio/tests/rt_threaded_alt.rs b/tokio/tests/rt_threaded_alt.rs index 8b7143b2f97..9eed1fe78b6 100644 --- a/tokio/tests/rt_threaded_alt.rs +++ b/tokio/tests/rt_threaded_alt.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] #![cfg(tokio_unstable)] diff --git a/tokio/tests/task_builder.rs b/tokio/tests/task_builder.rs index 78329ff26a4..5d465dc9967 100644 --- a/tokio/tests/task_builder.rs +++ b/tokio/tests/task_builder.rs @@ -1,3 +1,5 @@ +#![allow(unknown_lints, unexpected_cfgs)] + #[cfg(all(tokio_unstable, feature = "tracing"))] mod tests { use std::rc::Rc; diff --git a/tokio/tests/task_id.rs b/tokio/tests/task_id.rs index 95e48f4901d..574a050b0c1 100644 --- a/tokio/tests/task_id.rs +++ b/tokio/tests/task_id.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", tokio_unstable))] diff --git a/tokio/tests/task_join_set.rs b/tokio/tests/task_join_set.rs index 8a42be17b49..e87135337ba 100644 --- a/tokio/tests/task_join_set.rs +++ b/tokio/tests/task_join_set.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] diff --git a/tokio/tests/task_local_set.rs b/tokio/tests/task_local_set.rs index d965eb341eb..ac46291a36c 100644 --- a/tokio/tests/task_local_set.rs +++ b/tokio/tests/task_local_set.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] diff --git a/tokio/tests/task_yield_now.rs b/tokio/tests/task_yield_now.rs index b16bca52819..3cb8cb16e70 100644 --- a/tokio/tests/task_yield_now.rs +++ b/tokio/tests/task_yield_now.rs @@ -1,3 +1,4 @@ +#![allow(unknown_lints, unexpected_cfgs)] #![cfg(all(feature = "full", tokio_unstable))] use tokio::task; From 53cd1943427c5e0410cdb7cec523b4be96f2df31 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 14:56:26 +0200 Subject: [PATCH 06/22] Add more cfgs --- .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 9f9a8b902e3..4eba33c5ee7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1010,7 +1010,7 @@ jobs: - name: check for unknown lints and cfgs run: cargo check --all-features --tests env: - RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom) --check-cfg=cfg(tokio_unstable) --check-cfg=cfg(tokio_taskdump) -Funexpected_cfgs -Funknown_lints + RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom) --check-cfg=cfg(tokio_unstable) --check-cfg=cfg(tokio_taskdump) --check-cfg=cfg(fuzzing) --check-cfg=cfg(mio_unsupported_force_poll_poll) --check-cfg=cfg(tokio_internal_mt_counters) --check-cfg=cfg(fs) --check-cfg=cfg(tokio_no_parking_lot) -Funexpected_cfgs -Funknown_lints check-fuzzing: name: check-fuzzing From 82a584413dbb7d47db4b58f60e6df027f2a6c788 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 14:57:28 +0200 Subject: [PATCH 07/22] Remove 128 bits --- tokio/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index ea52b7e8a52..4dd1b2431f4 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -449,8 +449,7 @@ // TODO: improve once we have MSRV access to const eval to make more flexible. #[cfg(not(any( target_pointer_width = "32", - target_pointer_width = "64", - target_pointer_width = "128" + target_pointer_width = "64" )))] compile_error! { "Tokio requires the platform pointer width to be 32, 64, or 128 bits" From a841c187d25abc42bab8efcf484d413993648691 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 14:58:35 +0200 Subject: [PATCH 08/22] rustfmt --- tokio/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 4dd1b2431f4..da3b00d4117 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -447,10 +447,7 @@ // least 32 bits, which a lot of components in Tokio currently assumes. // // TODO: improve once we have MSRV access to const eval to make more flexible. -#[cfg(not(any( - target_pointer_width = "32", - target_pointer_width = "64" -)))] +#[cfg(not(any(target_pointer_width = "32", target_pointer_width = "64")))] compile_error! { "Tokio requires the platform pointer width to be 32, 64, or 128 bits" } From 5308ae8ee03b1066d9e281dc9b2ddb2e7e021906 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:01:48 +0200 Subject: [PATCH 09/22] Fixups --- tokio/src/lib.rs | 2 +- tokio/tests/_require_full.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index da3b00d4117..f15f8763e36 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -449,7 +449,7 @@ // TODO: improve once we have MSRV access to const eval to make more flexible. #[cfg(not(any(target_pointer_width = "32", target_pointer_width = "64")))] compile_error! { - "Tokio requires the platform pointer width to be 32, 64, or 128 bits" + "Tokio requires the platform pointer width to be at least 32 bits" } #[cfg(all( diff --git a/tokio/tests/_require_full.rs b/tokio/tests/_require_full.rs index d33943a960d..81c25179615 100644 --- a/tokio/tests/_require_full.rs +++ b/tokio/tests/_require_full.rs @@ -1,3 +1,5 @@ +#![allow(unknown_lints, unexpected_cfgs)] + #[cfg(not(any(feature = "full", target_family = "wasm")))] compile_error!("run main Tokio tests with `--features full`"); From b44b5b65a119dafba63997a61b1a351eb2f0dbbb Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:05:27 +0200 Subject: [PATCH 10/22] Fix length_delimited.rs --- tokio-util/src/codec/length_delimited.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tokio-util/src/codec/length_delimited.rs b/tokio-util/src/codec/length_delimited.rs index 92d76b2cd28..c37f5863bd4 100644 --- a/tokio-util/src/codec/length_delimited.rs +++ b/tokio-util/src/codec/length_delimited.rs @@ -639,7 +639,6 @@ mod builder { impl LengthFieldType for u64 {} #[cfg(any( - target_pointer_width = "8", target_pointer_width = "16", target_pointer_width = "32", target_pointer_width = "64", From 2ec45b7adc906249e42e22c0d65b0543682ccf68 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:05:33 +0200 Subject: [PATCH 11/22] Merge --check-cfg flags --- .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 4eba33c5ee7..7b54357926a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1010,7 +1010,7 @@ jobs: - name: check for unknown lints and cfgs run: cargo check --all-features --tests env: - RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom) --check-cfg=cfg(tokio_unstable) --check-cfg=cfg(tokio_taskdump) --check-cfg=cfg(fuzzing) --check-cfg=cfg(mio_unsupported_force_poll_poll) --check-cfg=cfg(tokio_internal_mt_counters) --check-cfg=cfg(fs) --check-cfg=cfg(tokio_no_parking_lot) -Funexpected_cfgs -Funknown_lints + RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom, tokio_unstable, tokio_taskdump, fuzzing, mio_unsupported_force_poll_poll, tokio_internal_mt_counters, fs, tokio_no_parking_lot) -Funexpected_cfgs -Funknown_lints check-fuzzing: name: check-fuzzing From 22eaf9466a5b334fc9288ffc1ca584c94e10c659 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:06:22 +0200 Subject: [PATCH 12/22] Fix PanicOnDrop warning --- tokio/tests/task_abort.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tokio/tests/task_abort.rs b/tokio/tests/task_abort.rs index 481cc96f2ef..09414f094ed 100644 --- a/tokio/tests/task_abort.rs +++ b/tokio/tests/task_abort.rs @@ -7,8 +7,10 @@ use tokio::time::Duration; use tokio::runtime::Builder; +#[cfg(panic = "unwind")] struct PanicOnDrop; +#[cfg(panic = "unwind")] impl Drop for PanicOnDrop { fn drop(&mut self) { panic!("Well what did you expect would happen..."); From 5057f2d0e42766786cb1dfc32d44dd5b7a9ca075 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:19:46 +0200 Subject: [PATCH 13/22] cfg some conditionally used things --- tokio/src/signal/mod.rs | 2 ++ tokio/src/signal/unix.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tokio/src/signal/mod.rs b/tokio/src/signal/mod.rs index 59f71db0e46..5778f22ed12 100644 --- a/tokio/src/signal/mod.rs +++ b/tokio/src/signal/mod.rs @@ -45,7 +45,9 @@ use crate::sync::watch::Receiver; use std::task::{Context, Poll}; +#[cfg(feature = "signal")] mod ctrl_c; +#[cfg(feature = "signal")] pub use ctrl_c::ctrl_c; pub(crate) mod registry; diff --git a/tokio/src/signal/unix.rs b/tokio/src/signal/unix.rs index 52a9cbaac40..c4a196a660f 100644 --- a/tokio/src/signal/unix.rs +++ b/tokio/src/signal/unix.rs @@ -485,10 +485,12 @@ impl Signal { } // Work around for abstracting streams internally +#[cfg(feature = "process")] pub(crate) trait InternalStream { fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll>; } +#[cfg(feature = "process")] impl InternalStream for Signal { fn poll_recv(&mut self, cx: &mut Context<'_>) -> Poll> { self.poll_recv(cx) From e35f6348b83067fa0446e3cbdcb1ae58f53d6044 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:22:58 +0200 Subject: [PATCH 14/22] Pin AtomicU64 check to specific nightly --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b54357926a..4fd7ee38f93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -599,10 +599,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Install Rust ${{ env.rust_nightly }} + # This check is broken on newer nightlies. + - name: Install Rust nightly-2023-10-21 uses: dtolnay/rust-toolchain@stable with: - toolchain: ${{ env.rust_nightly }} + toolchain: nightly-2023-10-21 components: rust-src - name: Install cargo-nextest From c6837748606f5e4d080079799c8add23a7b363cb Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:28:40 +0200 Subject: [PATCH 15/22] Catch failures in open_options_mode better next time I couldn't reproduce locally --- tokio/tests/fs_open_options.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tokio/tests/fs_open_options.rs b/tokio/tests/fs_open_options.rs index 41cfb45460c..6ee5e918aee 100644 --- a/tokio/tests/fs_open_options.rs +++ b/tokio/tests/fs_open_options.rs @@ -55,8 +55,9 @@ async fn open_options_create_new() { #[tokio::test] #[cfg(unix)] async fn open_options_mode() { + let mode = format!("{:?}", OpenOptions::new().mode(0o644)); // TESTING HACK: use Debug output to check the stored data - assert!(format!("{:?}", OpenOptions::new().mode(0o644)).contains("mode: 420 ")); + assert!(mode.contains("mode: 420 "), "mode is: {}", mode); } #[tokio::test] From a8945a68aa88e5736a60dc5c775ba5951bacf0d6 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:30:36 +0200 Subject: [PATCH 16/22] Regenerate `target-specs/i686-unknown-linux-gnu.json` --- .github/workflows/ci.yml | 5 ++--- target-specs/i686-unknown-linux-gnu.json | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fd7ee38f93..7b54357926a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -599,11 +599,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - # This check is broken on newer nightlies. - - name: Install Rust nightly-2023-10-21 + - name: Install Rust ${{ env.rust_nightly }} uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly-2023-10-21 + toolchain: ${{ env.rust_nightly }} components: rust-src - name: Install cargo-nextest diff --git a/target-specs/i686-unknown-linux-gnu.json b/target-specs/i686-unknown-linux-gnu.json index 4eebe7afb57..7a70e7474f3 100644 --- a/target-specs/i686-unknown-linux-gnu.json +++ b/target-specs/i686-unknown-linux-gnu.json @@ -1,29 +1,35 @@ { "arch": "x86", "cpu": "pentium4", + "crt-objects-fallback": "false", "crt-static-respected": true, - "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", + "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", "dynamic-linking": true, "env": "gnu", "has-rpath": true, "has-thread-local": true, + "linker-flavor": "gnu-cc", "llvm-target": "i686-unknown-linux-gnu", "max-atomic-width": 32, + "metadata": { + "description": null, + "host_tools": null, + "std": null, + "tier": null + }, "os": "linux", "position-independent-executables": true, "pre-link-args": { - "gcc": [ + "gnu-cc": [ + "-m32" + ], + "gnu-lld-cc": [ "-m32" ] }, "relro-level": "full", "stack-probes": { - "kind": "inline-or-call", - "min-llvm-version-for-inline": [ - 16, - 0, - 0 - ] + "kind": "inline" }, "supported-sanitizers": [ "address" From 6206a57a0c030f6dc641b25007bd1bfd1f598d0d Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:33:18 +0200 Subject: [PATCH 17/22] Bump required ahash version Fixes this error: error[E0635]: unknown feature `stdsimd` --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ahash-0.8.4/src/lib.rs:99:42 | 99 | #![cfg_attr(feature = "stdsimd", feature(stdsimd))] | ^^^^^^^ As of 0.8.7, ahash no longer tries to use stdsimd on nightly --- tokio-util/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tokio-util/Cargo.toml b/tokio-util/Cargo.toml index 13e56dd8511..53f5621a7d1 100644 --- a/tokio-util/Cargo.toml +++ b/tokio-util/Cargo.toml @@ -29,7 +29,7 @@ codec = [] time = ["tokio/time","slab"] io = [] io-util = ["io", "tokio/rt", "tokio/io-util"] -rt = ["tokio/rt", "tokio/sync", "futures-util", "hashbrown"] +rt = ["tokio/rt", "tokio/sync", "futures-util", "hashbrown", "ahash"] __docs_rs = ["futures-util"] @@ -46,6 +46,7 @@ tracing = { version = "0.1.25", default-features = false, features = ["std"], op [target.'cfg(tokio_unstable)'.dependencies] hashbrown = { version = "0.14.0", optional = true } +ahash = { version = "0.8.7", optional = true } [dev-dependencies] tokio = { version = "1.0.0", path = "../tokio", features = ["full"] } From 10dada2c3e5c10146a5f294a090116446b42ef50 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:37:39 +0200 Subject: [PATCH 18/22] Remove spaces from --check-cfg --- .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 7b54357926a..1164f5e15f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1010,7 +1010,7 @@ jobs: - name: check for unknown lints and cfgs run: cargo check --all-features --tests env: - RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom, tokio_unstable, tokio_taskdump, fuzzing, mio_unsupported_force_poll_poll, tokio_internal_mt_counters, fs, tokio_no_parking_lot) -Funexpected_cfgs -Funknown_lints + RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom,tokio_unstable,tokio_taskdump,fuzzing,mio_unsupported_force_poll_poll,tokio_internal_mt_counters,fs,tokio_no_parking_lot) -Funexpected_cfgs -Funknown_lints check-fuzzing: name: check-fuzzing From 0aa0d9a0cd8dfe292ef6220c7fe0b8f402a9e35e Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:42:56 +0200 Subject: [PATCH 19/22] Fix open_options_mode test --- tokio/tests/fs_open_options.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio/tests/fs_open_options.rs b/tokio/tests/fs_open_options.rs index 6ee5e918aee..a5b9dd65162 100644 --- a/tokio/tests/fs_open_options.rs +++ b/tokio/tests/fs_open_options.rs @@ -57,7 +57,7 @@ async fn open_options_create_new() { async fn open_options_mode() { let mode = format!("{:?}", OpenOptions::new().mode(0o644)); // TESTING HACK: use Debug output to check the stored data - assert!(mode.contains("mode: 420 "), "mode is: {}", mode); + assert!(mode.contains("mode: 420 ") || mode.contains("mode: 0o000644 "), "mode is: {}", mode); } #[tokio::test] From 02cb9161952d932a7420f0d697f9162ba65b824e Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:44:17 +0200 Subject: [PATCH 20/22] rustfmt --- tokio/tests/fs_open_options.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tokio/tests/fs_open_options.rs b/tokio/tests/fs_open_options.rs index a5b9dd65162..84b63a504cf 100644 --- a/tokio/tests/fs_open_options.rs +++ b/tokio/tests/fs_open_options.rs @@ -57,7 +57,11 @@ async fn open_options_create_new() { async fn open_options_mode() { let mode = format!("{:?}", OpenOptions::new().mode(0o644)); // TESTING HACK: use Debug output to check the stored data - assert!(mode.contains("mode: 420 ") || mode.contains("mode: 0o000644 "), "mode is: {}", mode); + assert!( + mode.contains("mode: 420 ") || mode.contains("mode: 0o000644 "), + "mode is: {}", + mode + ); } #[tokio::test] From 0ed2a9960e65d236ff7d10a76608b324e23d541a Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:46:20 +0200 Subject: [PATCH 21/22] Document how to regenerate target specs Co-authored-by: Taiki Endo --- target-specs/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 target-specs/README.md diff --git a/target-specs/README.md b/target-specs/README.md new file mode 100644 index 00000000000..f5db16b78c5 --- /dev/null +++ b/target-specs/README.md @@ -0,0 +1,9 @@ +This is used for the `no-atomic-u64-test` ci check that verifies that Tokio +works even if the `AtomicU64` type is missing. + +When increasing the nightly compiler version, you may need to regenerate this +target using the following command: +``` +rustc +nightly -Z unstable-options --print target-spec-json --target i686-unknown-linux-gnu | grep -v 'is-builtin' | sed 's/"max-atomic-width": 64/"max-atomic-width": 32/' > target-specs/i686-unknown-linux-gnu.json +``` + From f0659d6f39945c568876d18a093cde148ce1023f Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 5 May 2024 15:47:35 +0200 Subject: [PATCH 22/22] Allow --cfg tokio_no_tuning_tests --- .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 1164f5e15f8..1d799a54083 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1010,7 +1010,7 @@ jobs: - name: check for unknown lints and cfgs run: cargo check --all-features --tests env: - RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom,tokio_unstable,tokio_taskdump,fuzzing,mio_unsupported_force_poll_poll,tokio_internal_mt_counters,fs,tokio_no_parking_lot) -Funexpected_cfgs -Funknown_lints + RUSTFLAGS: -Dwarnings --check-cfg=cfg(loom,tokio_unstable,tokio_taskdump,fuzzing,mio_unsupported_force_poll_poll,tokio_internal_mt_counters,fs,tokio_no_parking_lot,tokio_no_tuning_tests) -Funexpected_cfgs -Funknown_lints check-fuzzing: name: check-fuzzing