From 604a0ff861df43b20f25165ea1c61b6559b26b99 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 2 May 2022 10:12:50 +0200 Subject: [PATCH 1/8] Use mocked AtomicU64 --- tokio/src/runtime/metrics/io.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio/src/runtime/metrics/io.rs b/tokio/src/runtime/metrics/io.rs index 4928c48e8d8..ba804f56c50 100644 --- a/tokio/src/runtime/metrics/io.rs +++ b/tokio/src/runtime/metrics/io.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "net"), allow(dead_code))] -use std::sync::atomic::{AtomicU64, Ordering::Relaxed}; +use loom::sync::atomic::{AtomicU64, Ordering::Relaxed}; #[derive(Default)] pub(crate) struct IoDriverMetrics { From 53ee43ad6a02e9c551095d3897c187c0b13f1f31 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 2 May 2022 10:15:29 +0200 Subject: [PATCH 2/8] Add mipsel-unknown-linux-musl to cross CI check --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84f0d76b988..91c2961c421 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -228,6 +228,7 @@ jobs: - powerpc64-unknown-linux-gnu - mips-unknown-linux-gnu - arm-linux-androideabi + - mipsel-unknown-linux-musl steps: - uses: actions/checkout@v2 - name: Install Rust ${{ env.rust_stable }} From 3f61e2bbeeba77bb03f33eb3233d0bd3cbdc958d Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 2 May 2022 10:16:55 +0200 Subject: [PATCH 3/8] Fix path --- tokio/src/runtime/metrics/io.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio/src/runtime/metrics/io.rs b/tokio/src/runtime/metrics/io.rs index ba804f56c50..9706bfc9bc2 100644 --- a/tokio/src/runtime/metrics/io.rs +++ b/tokio/src/runtime/metrics/io.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "net"), allow(dead_code))] -use loom::sync::atomic::{AtomicU64, Ordering::Relaxed}; +use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed}; #[derive(Default)] pub(crate) struct IoDriverMetrics { From 0c2c08d5077d800ba1d10189e3fedd0bebe5ffb5 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 2 May 2022 10:21:33 +0200 Subject: [PATCH 4/8] Add tokio_unstable cross check --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91c2961c421..7602fe5673c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -243,6 +243,13 @@ jobs: use-cross: true command: check args: --workspace --target ${{ matrix.target }} + - uses: actions-rs/cargo@v1 + with: + use-cross: true + command: check + args: --workspace --target ${{ matrix.target }} + env: + RUSTFLAGS: --cfg tokio_unstable -Dwarnings features: name: features From b2ff4854bbcf24d9bf33fbca9bf9d543fe91e4dd Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 2 May 2022 10:29:53 +0200 Subject: [PATCH 5/8] Try to actually get the cross check to fail --- Cross.toml | 4 ++++ tokio/src/runtime/metrics/io.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 Cross.toml diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 00000000000..050f2bdbd75 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,4 @@ +[build.env] +passthrough = [ + "RUSTFLAGS", +] diff --git a/tokio/src/runtime/metrics/io.rs b/tokio/src/runtime/metrics/io.rs index 9706bfc9bc2..4928c48e8d8 100644 --- a/tokio/src/runtime/metrics/io.rs +++ b/tokio/src/runtime/metrics/io.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "net"), allow(dead_code))] -use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed}; +use std::sync::atomic::{AtomicU64, Ordering::Relaxed}; #[derive(Default)] pub(crate) struct IoDriverMetrics { From 026dfd708cea9f13fc8fc44f03a01a4b0a16dbdc Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 2 May 2022 10:32:41 +0200 Subject: [PATCH 6/8] Now see if it succeeds --- tokio/src/runtime/metrics/io.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio/src/runtime/metrics/io.rs b/tokio/src/runtime/metrics/io.rs index 4928c48e8d8..9706bfc9bc2 100644 --- a/tokio/src/runtime/metrics/io.rs +++ b/tokio/src/runtime/metrics/io.rs @@ -1,6 +1,6 @@ #![cfg_attr(not(feature = "net"), allow(dead_code))] -use std::sync::atomic::{AtomicU64, Ordering::Relaxed}; +use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed}; #[derive(Default)] pub(crate) struct IoDriverMetrics { From 05a2f25437581264b39ac4f010624c7b6c9a9267 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 2 May 2022 10:40:45 +0200 Subject: [PATCH 7/8] Add Default for AtomicU64 mock --- tokio/src/loom/std/atomic_u64.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tokio/src/loom/std/atomic_u64.rs b/tokio/src/loom/std/atomic_u64.rs index 113992d9775..ac20f352943 100644 --- a/tokio/src/loom/std/atomic_u64.rs +++ b/tokio/src/loom/std/atomic_u64.rs @@ -75,4 +75,12 @@ cfg_not_has_atomic_u64! { self.compare_exchange(current, new, success, failure) } } + + impl Default for AtomicU64 { + fn default() -> AtomicU64 { + Self { + inner: Mutex::new(0), + } + } + } } From c8d994b99250a000272fb18a0052812b3b0099bd Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 2 May 2022 10:41:24 +0200 Subject: [PATCH 8/8] Add --all-features to cross --- .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 7602fe5673c..e344f1c1fa6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -242,12 +242,12 @@ jobs: with: use-cross: true command: check - args: --workspace --target ${{ matrix.target }} + args: --workspace --all-features --target ${{ matrix.target }} - uses: actions-rs/cargo@v1 with: use-cross: true command: check - args: --workspace --target ${{ matrix.target }} + args: --workspace --all-features --target ${{ matrix.target }} env: RUSTFLAGS: --cfg tokio_unstable -Dwarnings