diff --git a/.cirrus.yml b/.cirrus.yml index a7ce0d9d456..6a4e7b8e5af 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 a867a6e105f..f7e9102d7ec 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 2238deac71c..c215946f421 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 44156fcbfb5..de39565b398 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 54f2ecb8a4f..84112c08dab 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 6f744713f7c..c7ece458ff8 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 60c07e4eabd..79db8ce1da1 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 639dc3d1292..ee27d6b5ab5 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 74724917f15..5b15017b943 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 e47e4116049..3305385d94e 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 29ea2867cff..32353b3807b 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 81d9b9d2022..547d7f5deaf 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 f2b463bcb9a..28fa22a2ff6 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 536c5a848e8..c8d998fd368 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 9f60faf7952..87e63861210 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 d215590d9f2..b5a93dc3b50 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 34f69fd14e3..1df4de1b459 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 8757f8b5c6e..1ab5f9ba832 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 86017871680..2b0c1127a71 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 b85921f31de..a69def93634 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 a5f09d936dd..23180dc5245 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 81c25179615..d33943a960d 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 68b53aaf291..c946f38436c 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 fdf7fde1342..0c5ae6d9ab0 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 bed443cf293..bcc230f34fa 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 f2ec0df9ff6..cedea3811a3 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 26a2adbadaf..c07e3e9ddb9 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 3773b8972af..bfbeff1b2e4 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 1f14f5444d3..5d276250b34 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 e9f351007d5..ad3b0e367e0 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 777b0d6a07c..f0ed8443f9c 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 f7e52af83dd..c1dc71dedc1 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 85eba07d389..60cdc525ff1 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 4d1248500ab..c700f229f9f 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 1e2de7e4b4c..185b9126cca 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 c0aed66f16f..0cbf80d5ace 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 d07a2824889..f705fa507d7 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 d910efb8b65..30f20ed0d1d 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 3b462e92240..e6fe5d2009a 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 7391cd8b735..7065282c44b 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 5466ad960f0..a9317bf5b12 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 a227cde7a73..f251cc780b9 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"))]