From 40782efb769ef8d0df070089f9bca8b6125d6421 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 15 Jan 2023 04:11:05 +0900 Subject: [PATCH] tokio: fix remaining issues about atomic_u64_static_once_cell.rs (#5374) Fixes #5373 Closes #5358 - Add check for no_atomic_u64 & no_const_mutex_new (condition to atomic_u64_static_once_cell.rs is compiled) - Allow unused_imports in TARGET_ATOMIC_U64_PROBE. I also tested other *_PROBE and found no other errors triggered by -D warning. - Fix cfg of util::once_cell module --- .github/workflows/ci.yml | 10 ++++++++++ tokio/build.rs | 3 ++- tokio/src/util/mod.rs | 7 ++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88fa10f5fca..2813ede8a86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -300,6 +300,8 @@ jobs: with: toolchain: ${{ env.rust_nightly }} components: rust-src + - name: Install cargo-hack + uses: taiki-e/install-action@cargo-hack # Install linker and libraries for i686-unknown-linux-gnu - uses: taiki-e/setup-cross-toolchain-action@v1 with: @@ -307,6 +309,14 @@ jobs: - run: cargo test -Zbuild-std --target target-specs/i686-unknown-linux-gnu.json -p tokio --all-features env: RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_atomic_u64 + # https://github.com/tokio-rs/tokio/pull/5356 + # https://github.com/tokio-rs/tokio/issues/5373 + - run: cargo hack build -p tokio --feature-powerset --depth 2 -Z avoid-dev-deps --keep-going + env: + RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_atomic_u64 --cfg tokio_no_const_mutex_new + - run: cargo hack build -p tokio --feature-powerset --depth 2 -Z avoid-dev-deps --keep-going + env: + RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_atomic_u64 features: name: features diff --git a/tokio/build.rs b/tokio/build.rs index 503c0242fc8..ddade2876bb 100644 --- a/tokio/build.rs +++ b/tokio/build.rs @@ -27,12 +27,13 @@ const CONST_MUTEX_NEW_PROBE: &str = r#" const TARGET_HAS_ATOMIC_PROBE: &str = r#" { #[cfg(target_has_atomic = "ptr")] - let _ = (); + let _ = (); } "#; const TARGET_ATOMIC_U64_PROBE: &str = r#" { + #[allow(unused_imports)] use std::sync::atomic::AtomicU64 as _; } "#; diff --git a/tokio/src/util/mod.rs b/tokio/src/util/mod.rs index 245e64de6b4..9f6119acbb5 100644 --- a/tokio/src/util/mod.rs +++ b/tokio/src/util/mod.rs @@ -6,7 +6,12 @@ cfg_io_driver! { #[cfg(feature = "rt")] pub(crate) mod atomic_cell; -#[cfg(any(feature = "rt", feature = "signal", feature = "process"))] +#[cfg(any( + feature = "rt", + feature = "signal", + feature = "process", + tokio_no_const_mutex_new, +))] pub(crate) mod once_cell; #[cfg(any(