diff --git a/.cirrus.yml b/.cirrus.yml index a7ce0d9d4..6a4e7b8e5 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -4,7 +4,7 @@ freebsd_instance: image_family: freebsd-14-1 env: RUST_STABLE: stable - RUST_NIGHTLY: nightly-2024-05-05 + RUST_NIGHTLY: nightly-2025-01-25 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 a867a6e10..f7e9102d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ env: RUSTUP_WINDOWS_PATH_ADD_BIN: 1 # Change to specific Rust release to pin rust_stable: stable - rust_nightly: nightly-2024-05-05 + rust_nightly: nightly-2025-01-25 # Pin a specific miri version - rust_miri_nightly: nightly-2024-10-21 + rust_miri_nightly: nightly-2025-01-25 rust_clippy: '1.77' # When updating this, also update: # - README.md @@ -1086,23 +1086,6 @@ 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: don't allow warnings - 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,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 needs: basics diff --git a/Cargo.toml b/Cargo.toml index 2238deac7..c215946f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,3 +17,15 @@ members = [ [workspace.metadata.spellcheck] config = "spellcheck.toml" + +[workspace.lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(fuzzing)', + 'cfg(loom)', + 'cfg(mio_unsupported_force_poll_poll)', + 'cfg(tokio_internal_mt_counters)', + 'cfg(tokio_no_parking_lot)', + 'cfg(tokio_no_tuning_tests)', + 'cfg(tokio_taskdump)', + 'cfg(tokio_unstable)', +] } diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 44156fcbf..de39565b3 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -95,3 +95,6 @@ harness = false name = "time_timeout" path = "time_timeout.rs" harness = false + +[lints] +workspace = true diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 54f2ecb8a..84112c08d 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -95,3 +95,6 @@ path = "named-pipe-multi-client.rs" [[example]] name = "dump" path = "dump.rs" + +[lints] +workspace = true diff --git a/examples/dump.rs b/examples/dump.rs index 6f744713f..c7ece458f 100644 --- a/examples/dump.rs +++ b/examples/dump.rs @@ -1,5 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] - //! This example demonstrates tokio's experimental task dumping functionality. //! This application deadlocks. Input CTRL+C to display traces of each task, or //! input CTRL+C twice within 1 second to quit. diff --git a/stress-test/Cargo.toml b/stress-test/Cargo.toml index 60c07e4ea..79db8ce1d 100644 --- a/stress-test/Cargo.toml +++ b/stress-test/Cargo.toml @@ -13,3 +13,6 @@ tokio = { version = "1.0.0", path = "../tokio/", features = ["full"] } [dev-dependencies] rand = "0.8" + +[lints] +workspace = true diff --git a/tests-build/Cargo.toml b/tests-build/Cargo.toml index 639dc3d12..ee27d6b5a 100644 --- a/tests-build/Cargo.toml +++ b/tests-build/Cargo.toml @@ -15,3 +15,6 @@ tokio = { version = "1.0.0", path = "../tokio", optional = true } [dev-dependencies] trybuild = "1.0" + +[lints] +workspace = true diff --git a/tests-integration/Cargo.toml b/tests-integration/Cargo.toml index 74724917f..5b15017b9 100644 --- a/tests-integration/Cargo.toml +++ b/tests-integration/Cargo.toml @@ -61,3 +61,6 @@ tokio-test = { version = "0.4", path = "../tokio-test", optional = true } doc-comment = "0.3.1" futures = { version = "0.3.0", features = ["async-await"] } bytes = "1.0.0" + +[lints] +workspace = true diff --git a/tokio-macros/Cargo.toml b/tokio-macros/Cargo.toml index e47e41160..3305385d9 100644 --- a/tokio-macros/Cargo.toml +++ b/tokio-macros/Cargo.toml @@ -31,3 +31,6 @@ tokio = { version = "1.0.0", path = "../tokio", features = ["full"] } [package.metadata.docs.rs] all-features = true + +[lints] +workspace = true diff --git a/tokio-macros/src/lib.rs b/tokio-macros/src/lib.rs index 29ea2867c..32353b380 100644 --- a/tokio-macros/src/lib.rs +++ b/tokio-macros/src/lib.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![allow(clippy::needless_doctest_main)] #![warn( missing_debug_implementations, @@ -211,7 +210,6 @@ use proc_macro::TokenStream; /// This option is only compatible with the `current_thread` runtime. /// /// ```no_run -/// # #![allow(unknown_lints, unexpected_cfgs)] /// #[cfg(tokio_unstable)] /// #[tokio::main(flavor = "current_thread", unhandled_panic = "shutdown_runtime")] /// async fn main() { @@ -226,7 +224,6 @@ use proc_macro::TokenStream; /// Equivalent code not using `#[tokio::main]` /// /// ```no_run -/// # #![allow(unknown_lints, unexpected_cfgs)] /// #[cfg(tokio_unstable)] /// fn main() { /// tokio::runtime::Builder::new_current_thread() @@ -480,7 +477,6 @@ pub fn main_rt(args: TokenStream, item: TokenStream) -> TokenStream { /// This option is only compatible with the `current_thread` runtime. /// /// ```no_run -/// # #![allow(unknown_lints, unexpected_cfgs)] /// #[cfg(tokio_unstable)] /// #[tokio::test(flavor = "current_thread", unhandled_panic = "shutdown_runtime")] /// async fn my_test() { @@ -495,7 +491,6 @@ pub fn main_rt(args: TokenStream, item: TokenStream) -> TokenStream { /// Equivalent code not using `#[tokio::test]` /// /// ```no_run -/// # #![allow(unknown_lints, unexpected_cfgs)] /// #[cfg(tokio_unstable)] /// #[test] /// fn my_test() { diff --git a/tokio-stream/Cargo.toml b/tokio-stream/Cargo.toml index 81d9b9d20..547d7f5de 100644 --- a/tokio-stream/Cargo.toml +++ b/tokio-stream/Cargo.toml @@ -56,3 +56,6 @@ rustdoc-args = ["--cfg", "docsrs"] # This should allow `docsrs` to be read across projects, so that `tokio-stream` # can pick up stubbed types exported by `tokio`. rustc-args = ["--cfg", "docsrs"] + +[lints] +workspace = true diff --git a/tokio-stream/src/lib.rs b/tokio-stream/src/lib.rs index f2b463bcb..28fa22a2f 100644 --- a/tokio-stream/src/lib.rs +++ b/tokio-stream/src/lib.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![allow( clippy::cognitive_complexity, clippy::large_enum_variant, diff --git a/tokio-test/Cargo.toml b/tokio-test/Cargo.toml index 536c5a848..c8d998fd3 100644 --- a/tokio-test/Cargo.toml +++ b/tokio-test/Cargo.toml @@ -30,3 +30,6 @@ futures-util = "0.3.0" [package.metadata.docs.rs] all-features = true + +[lints] +workspace = true diff --git a/tokio-test/src/lib.rs b/tokio-test/src/lib.rs index 9f60faf79..87e638612 100644 --- a/tokio-test/src/lib.rs +++ b/tokio-test/src/lib.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![warn( missing_debug_implementations, missing_docs, diff --git a/tokio-util/Cargo.toml b/tokio-util/Cargo.toml index d215590d9..b5a93dc3b 100644 --- a/tokio-util/Cargo.toml +++ b/tokio-util/Cargo.toml @@ -68,3 +68,6 @@ rustc-args = ["--cfg", "docsrs", "--cfg", "tokio_unstable"] [package.metadata.playground] features = ["full"] + +[lints] +workspace = true diff --git a/tokio-util/src/lib.rs b/tokio-util/src/lib.rs index 34f69fd14..1df4de1b4 100644 --- a/tokio-util/src/lib.rs +++ b/tokio-util/src/lib.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![allow(clippy::needless_doctest_main)] #![warn( missing_debug_implementations, diff --git a/tokio-util/tests/task_join_map.rs b/tokio-util/tests/task_join_map.rs index 8757f8b5c..1ab5f9ba8 100644 --- a/tokio-util/tests/task_join_map.rs +++ b/tokio-util/tests/task_join_map.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(feature = "rt", tokio_unstable))] diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index 860178716..2b0c1127a 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -173,3 +173,6 @@ allowed_external_types = [ "bytes::buf::buf_mut::BufMut", "tokio_macros::*", ] + +[lints] +workspace = true diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index b85921f31..a69def936 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![allow( clippy::cognitive_complexity, clippy::large_enum_variant, diff --git a/tokio/src/runtime/blocking/pool.rs b/tokio/src/runtime/blocking/pool.rs index a5f09d936..23180dc52 100644 --- a/tokio/src/runtime/blocking/pool.rs +++ b/tokio/src/runtime/blocking/pool.rs @@ -128,7 +128,7 @@ pub(crate) struct Task { #[derive(PartialEq, Eq)] pub(crate) enum Mandatory { - #[cfg_attr(not(fs), allow(dead_code))] + #[cfg_attr(not(feature = "fs"), allow(dead_code))] Mandatory, NonMandatory, } diff --git a/tokio/tests/_require_full.rs b/tokio/tests/_require_full.rs index 81c251796..d33943a96 100644 --- a/tokio/tests/_require_full.rs +++ b/tokio/tests/_require_full.rs @@ -1,5 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] - #[cfg(not(any(feature = "full", target_family = "wasm")))] compile_error!("run main Tokio tests with `--features full`"); diff --git a/tokio/tests/dump.rs b/tokio/tests/dump.rs index 68b53aaf2..c946f3843 100644 --- a/tokio/tests/dump.rs +++ b/tokio/tests/dump.rs @@ -1,4 +1,3 @@ -#![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 fdf7fde13..0c5ae6d9a 100644 --- a/tokio/tests/macros_select.rs +++ b/tokio/tests/macros_select.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![cfg(feature = "macros")] #![allow(clippy::disallowed_names)] diff --git a/tokio/tests/macros_test.rs b/tokio/tests/macros_test.rs index bed443cf2..bcc230f34 100644 --- a/tokio/tests/macros_test.rs +++ b/tokio/tests/macros_test.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threading use tokio::test; diff --git a/tokio/tests/rt_basic.rs b/tokio/tests/rt_basic.rs index f2ec0df9f..cedea3811 100644 --- a/tokio/tests/rt_basic.rs +++ b/tokio/tests/rt_basic.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] #![cfg(not(miri))] // Possible bug on Miri. diff --git a/tokio/tests/rt_common.rs b/tokio/tests/rt_common.rs index 26a2adbad..c07e3e9dd 100644 --- a/tokio/tests/rt_common.rs +++ b/tokio/tests/rt_common.rs @@ -1,4 +1,3 @@ -#![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 3773b8972..bfbeff1b2 100644 --- a/tokio/tests/rt_handle.rs +++ b/tokio/tests/rt_handle.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] diff --git a/tokio/tests/rt_local.rs b/tokio/tests/rt_local.rs index 1f14f5444..5d276250b 100644 --- a/tokio/tests/rt_local.rs +++ b/tokio/tests/rt_local.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", tokio_unstable))] diff --git a/tokio/tests/rt_metrics.rs b/tokio/tests/rt_metrics.rs index e9f351007..ad3b0e367 100644 --- a/tokio/tests/rt_metrics.rs +++ b/tokio/tests/rt_metrics.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi"), target_has_atomic = "64"))] diff --git a/tokio/tests/rt_threaded.rs b/tokio/tests/rt_threaded.rs index 777b0d6a0..f0ed8443f 100644 --- a/tokio/tests/rt_threaded.rs +++ b/tokio/tests/rt_threaded.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] // Too slow on miri. #![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] diff --git a/tokio/tests/rt_threaded_alt.rs b/tokio/tests/rt_threaded_alt.rs index f7e52af83..c1dc71ded 100644 --- a/tokio/tests/rt_threaded_alt.rs +++ b/tokio/tests/rt_threaded_alt.rs @@ -1,4 +1,3 @@ -#![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/rt_unstable_metrics.rs b/tokio/tests/rt_unstable_metrics.rs index 85eba07d3..60cdc525f 100644 --- a/tokio/tests/rt_unstable_metrics.rs +++ b/tokio/tests/rt_unstable_metrics.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all( feature = "full", diff --git a/tokio/tests/task_builder.rs b/tokio/tests/task_builder.rs index 4d1248500..c700f229f 100644 --- a/tokio/tests/task_builder.rs +++ b/tokio/tests/task_builder.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![cfg(all(tokio_unstable, feature = "tracing"))] use std::rc::Rc; diff --git a/tokio/tests/task_hooks.rs b/tokio/tests/task_hooks.rs index 1e2de7e4b..185b9126c 100644 --- a/tokio/tests/task_hooks.rs +++ b/tokio/tests/task_hooks.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(feature = "full", tokio_unstable, target_has_atomic = "64"))] diff --git a/tokio/tests/task_id.rs b/tokio/tests/task_id.rs index c0aed66f1..0cbf80d5a 100644 --- a/tokio/tests/task_id.rs +++ b/tokio/tests/task_id.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] diff --git a/tokio/tests/task_join_set.rs b/tokio/tests/task_join_set.rs index d07a28248..f705fa507 100644 --- a/tokio/tests/task_join_set.rs +++ b/tokio/tests/task_join_set.rs @@ -1,4 +1,3 @@ -#![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 d910efb8b..30f20ed0d 100644 --- a/tokio/tests/task_local_set.rs +++ b/tokio/tests/task_local_set.rs @@ -1,4 +1,3 @@ -#![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 3b462e922..e6fe5d200 100644 --- a/tokio/tests/task_yield_now.rs +++ b/tokio/tests/task_yield_now.rs @@ -1,4 +1,3 @@ -#![allow(unknown_lints, unexpected_cfgs)] #![cfg(all(feature = "full", not(target_os = "wasi"), tokio_unstable))] use tokio::task; diff --git a/tokio/tests/tracing_sync.rs b/tokio/tests/tracing_sync.rs index 7391cd8b7..7065282c4 100644 --- a/tokio/tests/tracing_sync.rs +++ b/tokio/tests/tracing_sync.rs @@ -2,7 +2,6 @@ //! //! These tests ensure that the instrumentation for tokio //! synchronization primitives is correct. -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))] diff --git a/tokio/tests/tracing_task.rs b/tokio/tests/tracing_task.rs index 5466ad960..a9317bf5b 100644 --- a/tokio/tests/tracing_task.rs +++ b/tokio/tests/tracing_task.rs @@ -2,7 +2,6 @@ //! //! These tests ensure that the instrumentation for task spawning and task //! lifecycles is correct. -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))] diff --git a/tokio/tests/tracing_time.rs b/tokio/tests/tracing_time.rs index a227cde7a..f251cc780 100644 --- a/tokio/tests/tracing_time.rs +++ b/tokio/tests/tracing_time.rs @@ -2,7 +2,6 @@ //! //! These tests ensure that the instrumentation for tokio //! synchronization primitives is correct. -#![allow(unknown_lints, unexpected_cfgs)] #![warn(rust_2018_idioms)] #![cfg(all(tokio_unstable, feature = "tracing", target_has_atomic = "64"))]