From 0a35fbfa7f7c60f884a402f0186240b16233add4 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Mon, 4 Dec 2023 13:38:13 +0100 Subject: [PATCH] Add CI config from main branch, fix build. --- .github/bors.toml | 3 - .github/workflows/build.yml | 273 ++++++++++++++------------------ .github/workflows/changelog.yml | 2 +- cfail/ui/not-send.stderr | 146 ++++++++++------- src/lib.rs | 1 - src/linear_map.rs | 9 -- 6 files changed, 213 insertions(+), 221 deletions(-) delete mode 100644 .github/bors.toml diff --git a/.github/bors.toml b/.github/bors.toml deleted file mode 100644 index aee6042f81..0000000000 --- a/.github/bors.toml +++ /dev/null @@ -1,3 +0,0 @@ -block_labels = ["S-blocked"] -delete_merged_branches = true -status = ["ci"] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac1efebb45..3a6575652e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,35 +1,104 @@ name: Build on: + merge_group: pull_request: - branches: [main] push: - branches: [main, staging, trying] + branches: [v0.7.x] + workflow_dispatch: env: CARGO_TERM_COLOR: always jobs: + # Run MIRI tests on nightly + # NOTE first because it takes the longest to complete + testmiri: + name: testmiri + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Cache cargo dependencies + uses: actions/cache@v3 + with: + path: | + - ~/.cargo/bin/ + - ~/.cargo/registry/index/ + - ~/.cargo/registry/cache/ + - ~/.cargo/git/db/ + key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-cargo- + + - name: Cache build output dependencies + uses: actions/cache@v3 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build- + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly + components: miri + + - name: Run miri + run: MIRIFLAGS=-Zmiri-ignore-leaks cargo miri test + + # Run cargo test + test: + name: test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Cache cargo dependencies + uses: actions/cache@v3 + with: + path: | + - ~/.cargo/bin/ + - ~/.cargo/registry/index/ + - ~/.cargo/registry/cache/ + - ~/.cargo/git/db/ + key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-cargo- + + - name: Cache build output dependencies + uses: actions/cache@v3 + with: + path: target + key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.OS }}-build- + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Run cargo test + run: cargo test + # Run cargo fmt --check style: name: style runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@nightly with: - profile: minimal - toolchain: stable - override: true components: rustfmt - name: cargo fmt --check - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + run: cargo fmt --all -- --check # Compilation check check: @@ -46,19 +115,12 @@ jobs: - thumbv7m-none-eabi - thumbv8m.base-none-eabi - thumbv8m.main-none-eabi - toolchain: - - stable - - nightly - features: - - "" - - "cas" - - "serde" steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache cargo dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | - ~/.cargo/bin/ @@ -71,7 +133,7 @@ jobs: ${{ runner.OS }}-cargo- - name: Cache build output dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: target key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} @@ -79,19 +141,16 @@ jobs: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} ${{ runner.OS }}-build- - - name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) - uses: actions-rs/toolchain@v1 + - name: Install Rust with target (${{ matrix.target }}) + uses: dtolnay/rust-toolchain@master with: - toolchain: ${{ matrix.toolchain }} - target: ${{ matrix.target }} - override: true + toolchain: stable + targets: ${{ matrix.target }} - name: cargo check - uses: actions-rs/cargo@v1 - with: - use-cross: false - command: check - args: --target=${{ matrix.target }} --no-default-features --features=${{ matrix.features }} + run: | + cargo check --target=${{ matrix.target }} + cargo check --target=${{ matrix.target }} --features="ufmt-impl serde defmt-impl mpmc_large" doc: name: doc @@ -101,16 +160,12 @@ jobs: target: - x86_64-unknown-linux-gnu - thumbv7m-none-eabi - features: - - "" - - "cas" - - "serde" steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache cargo dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | - ~/.cargo/bin/ @@ -123,7 +178,7 @@ jobs: ${{ runner.OS }}-cargo- - name: Cache build output dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: target key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} @@ -131,19 +186,14 @@ jobs: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} ${{ runner.OS }}-build- - - name: Install stable Rust with target (${{ matrix.target }}) - uses: actions-rs/toolchain@v1 + - name: Install nightly Rust with target (${{ matrix.target }}) + uses: dtolnay/rust-toolchain@nightly with: - toolchain: stable - target: ${{ matrix.target }} - override: true + targets: ${{ matrix.target }} - - name: cargo doc - uses: actions-rs/cargo@v1 - with: - use-cross: false - command: doc - args: --target=${{ matrix.target }} --no-default-features --features=${{ matrix.features }} + - name: cargo rustdoc + env: {"RUSTDOCFLAGS": "-D warnings --cfg docsrs"} + run: cargo rustdoc --target=${{ matrix.target }} --features="ufmt-impl serde defmt-impl mpmc_large" # Run cpass tests testcpass: @@ -154,21 +204,15 @@ jobs: target: - x86_64-unknown-linux-gnu - i686-unknown-linux-musl - toolchain: - - stable - - nightly - - 1.51.0 - features: - - serde buildtype: - "" - "--release" steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache cargo dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | - ~/.cargo/bin/ @@ -181,7 +225,7 @@ jobs: ${{ runner.OS }}-cargo- - name: Cache build output dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: target key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} @@ -189,17 +233,14 @@ jobs: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} ${{ runner.OS }}-build- - - name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - target: ${{ matrix.target }} - override: true - - uses: actions-rs/cargo@v1 + - name: Install Rust with target (${{ matrix.target }}) + uses: dtolnay/rust-toolchain@master with: - use-cross: false - command: test - args: --test cpass --target=${{ matrix.target }} --features=${{ matrix.features }} ${{ matrix.buildtype }} + toolchain: stable + targets: ${{ matrix.target }} + + - name: cargo test + run: cargo test --test cpass --target=${{ matrix.target }} --features=serde ${{ matrix.buildtype }} # Run test suite for UI testtsan: @@ -209,19 +250,15 @@ jobs: matrix: target: - x86_64-unknown-linux-gnu - toolchain: - - nightly - features: - - x86-sync-pool buildtype: - "" - "--release" steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache cargo dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | - ~/.cargo/bin/ @@ -233,19 +270,19 @@ jobs: ${{ runner.OS }}-cargo- - name: Cache build output dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: target key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.OS }}-build- - - name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }}) - uses: actions-rs/toolchain@v1 + - name: Install Rust nightly with target (${{ matrix.target }}) + uses: dtolnay/rust-toolchain@master with: - toolchain: ${{ matrix.toolchain }} + toolchain: nightly target: ${{ matrix.target }} - override: true + components: rust-src - name: Export variables run: | @@ -253,11 +290,8 @@ jobs: echo TSAN_OPTIONS="suppressions=$(pwd)/suppressions.txt" >> $GITHUB_ENV echo $GITHUB_ENV - - uses: actions-rs/cargo@v1 - with: - use-cross: false - command: test - args: --test tsan --target=${{ matrix.target }} --features=${{ matrix.features }} ${{ matrix.buildtype }} -- --test-threads=1 + - name: cargo test + run: cargo test -Zbuild-std --test tsan --target=${{ matrix.target }} --features=${{ matrix.features }} ${{ matrix.buildtype }} -- --test-threads=1 # Run cfail tests on MSRV testcfail: @@ -269,10 +303,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache cargo dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | - ~/.cargo/bin/ @@ -284,7 +318,7 @@ jobs: ${{ runner.OS }}-cargo- - name: Cache build output dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: target key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} @@ -292,70 +326,7 @@ jobs: ${{ runner.OS }}-build- - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.51.0 - target: x86_64-unknown-linux-gnu - override: true + uses: dtolnay/rust-toolchain@stable - name: Run cargo run: cargo run - - - # Run MIRI tests on nightly - testmiri: - name: testmiri - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Cache cargo dependencies - uses: actions/cache@v2 - with: - path: | - - ~/.cargo/bin/ - - ~/.cargo/registry/index/ - - ~/.cargo/registry/cache/ - - ~/.cargo/git/db/ - key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.OS }}-cargo- - - - name: Cache build output dependencies - uses: actions/cache@v2 - with: - path: target - key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.OS }}-build- - - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - target: x86_64-unknown-linux-gnu - components: miri - override: true - - - name: Run miri - run: MIRIFLAGS=-Zmiri-ignore-leaks cargo miri test - - # Refs: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149 - # - # ALL THE PREVIOUS JOBS NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB! - - ci-success: - name: ci - if: github.event_name == 'push' && success() - needs: - - style - - check - - doc - - testcpass - - testtsan - - testcfail - runs-on: ubuntu-latest - steps: - - name: Mark the job as a success - run: exit 0 diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index ccf6eb9103..8fc8d29074 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Check that changelog updated uses: dangoslen/changelog-enforcer@v3 diff --git a/cfail/ui/not-send.stderr b/cfail/ui/not-send.stderr index 4fa461a185..40645b7a6d 100644 --- a/cfail/ui/not-send.stderr +++ b/cfail/ui/not-send.stderr @@ -1,89 +1,123 @@ error[E0277]: `*const ()` cannot be sent between threads safely - --> $DIR/not-send.rs:19:5 + --> ui/not-send.rs:19:15 | -12 | fn is_send() - | ------- required by a bound in this -13 | where -14 | T: Send, - | ---- required by this bound in `is_send` -... 19 | is_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | = help: within `PhantomData<*const ()>`, the trait `Send` is not implemented for `*const ()` - = note: required because it appears within the type `PhantomData<*const ()>` - = note: required because of the requirements on the impl of `Send` for `Consumer<'_, PhantomData<*const ()>, 4_usize>` - -error[E0277]: `*const ()` cannot be sent between threads safely - --> $DIR/not-send.rs:20:5 +note: required because it appears within the type `PhantomData<*const ()>` + --> $RUST/core/src/marker.rs + = note: required for `Consumer<'_, PhantomData<*const ()>, 4>` to implement `Send` +note: required by a bound in `is_send` + --> ui/not-send.rs:14:8 | 12 | fn is_send() - | ------- required by a bound in this + | ------- required by a bound in this function 13 | where 14 | T: Send, - | ---- required by this bound in `is_send` -... + | ^^^^ required by this bound in `is_send` + +error[E0277]: `*const ()` cannot be sent between threads safely + --> ui/not-send.rs:20:15 + | 20 | is_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | = help: within `PhantomData<*const ()>`, the trait `Send` is not implemented for `*const ()` - = note: required because it appears within the type `PhantomData<*const ()>` - = note: required because of the requirements on the impl of `Send` for `Producer<'_, PhantomData<*const ()>, 4_usize>` - -error[E0277]: `*const ()` cannot be sent between threads safely - --> $DIR/not-send.rs:21:5 +note: required because it appears within the type `PhantomData<*const ()>` + --> $RUST/core/src/marker.rs + = note: required for `Producer<'_, PhantomData<*const ()>, 4>` to implement `Send` +note: required by a bound in `is_send` + --> ui/not-send.rs:14:8 | 12 | fn is_send() - | ------- required by a bound in this + | ------- required by a bound in this function 13 | where 14 | T: Send, - | ---- required by this bound in `is_send` -... + | ^^^^ required by this bound in `is_send` + +error[E0277]: `*const ()` cannot be sent between threads safely + --> ui/not-send.rs:21:15 + | 21 | is_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | - = help: within `Queue, 4_usize>`, the trait `Send` is not implemented for `*const ()` - = note: required because it appears within the type `PhantomData<*const ()>` - = note: required because it appears within the type `ManuallyDrop>` - = note: required because it appears within the type `MaybeUninit>` - = note: required because it appears within the type `UnsafeCell>>` + = help: within `Queue, 4>`, the trait `Send` is not implemented for `*const ()` +note: required because it appears within the type `PhantomData<*const ()>` + --> $RUST/core/src/marker.rs +note: required because it appears within the type `ManuallyDrop>` + --> $RUST/core/src/mem/manually_drop.rs +note: required because it appears within the type `MaybeUninit>` + --> $RUST/core/src/mem/maybe_uninit.rs +note: required because it appears within the type `UnsafeCell>>` + --> $RUST/core/src/cell.rs = note: required because it appears within the type `[UnsafeCell>>; 4]` - = note: required because it appears within the type `Queue, 4_usize>` - -error[E0277]: `*const ()` cannot be sent between threads safely - --> $DIR/not-send.rs:22:5 +note: required because it appears within the type `Queue, 4>` + --> $HEAPLESS/src/spsc.rs + | + | pub struct Queue { + | ^^^^^ +note: required by a bound in `is_send` + --> ui/not-send.rs:14:8 | 12 | fn is_send() - | ------- required by a bound in this + | ------- required by a bound in this function 13 | where 14 | T: Send, - | ---- required by this bound in `is_send` -... + | ^^^^ required by this bound in `is_send` + +error[E0277]: `*const ()` cannot be sent between threads safely + --> ui/not-send.rs:22:15 + | 22 | is_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | - = help: within `heapless::Vec, 4_usize>`, the trait `Send` is not implemented for `*const ()` - = note: required because it appears within the type `PhantomData<*const ()>` - = note: required because it appears within the type `ManuallyDrop>` - = note: required because it appears within the type `MaybeUninit>` + = help: within `heapless::Vec, 4>`, the trait `Send` is not implemented for `*const ()` +note: required because it appears within the type `PhantomData<*const ()>` + --> $RUST/core/src/marker.rs +note: required because it appears within the type `ManuallyDrop>` + --> $RUST/core/src/mem/manually_drop.rs +note: required because it appears within the type `MaybeUninit>` + --> $RUST/core/src/mem/maybe_uninit.rs = note: required because it appears within the type `[MaybeUninit>; 4]` - = note: required because it appears within the type `heapless::Vec, 4_usize>` - -error[E0277]: `*const ()` cannot be sent between threads safely - --> $DIR/not-send.rs:23:5 +note: required because it appears within the type `Vec, 4>` + --> $HEAPLESS/src/vec.rs + | + | pub struct Vec { + | ^^^ +note: required by a bound in `is_send` + --> ui/not-send.rs:14:8 | 12 | fn is_send() - | ------- required by a bound in this + | ------- required by a bound in this function 13 | where 14 | T: Send, - | ---- required by this bound in `is_send` -... + | ^^^^ required by this bound in `is_send` + +error[E0277]: `*const ()` cannot be sent between threads safely + --> ui/not-send.rs:23:15 + | 23 | is_send::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely + | ^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely | - = help: within `HistoryBuffer, 4_usize>`, the trait `Send` is not implemented for `*const ()` - = note: required because it appears within the type `PhantomData<*const ()>` - = note: required because it appears within the type `ManuallyDrop>` - = note: required because it appears within the type `MaybeUninit>` + = help: within `HistoryBuffer, 4>`, the trait `Send` is not implemented for `*const ()` +note: required because it appears within the type `PhantomData<*const ()>` + --> $RUST/core/src/marker.rs +note: required because it appears within the type `ManuallyDrop>` + --> $RUST/core/src/mem/manually_drop.rs +note: required because it appears within the type `MaybeUninit>` + --> $RUST/core/src/mem/maybe_uninit.rs = note: required because it appears within the type `[MaybeUninit>; 4]` - = note: required because it appears within the type `HistoryBuffer, 4_usize>` +note: required because it appears within the type `HistoryBuffer, 4>` + --> $HEAPLESS/src/histbuf.rs + | + | pub struct HistoryBuffer { + | ^^^^^^^^^^^^^ +note: required by a bound in `is_send` + --> ui/not-send.rs:14:8 + | +12 | fn is_send() + | ------- required by a bound in this function +13 | where +14 | T: Send, + | ^^^^ required by this bound in `is_send` diff --git a/src/lib.rs b/src/lib.rs index 92463b31a3..cb53d5a515 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -72,7 +72,6 @@ #![deny(rust_2018_compatibility)] #![deny(rust_2018_idioms)] #![deny(warnings)] -#![deny(const_err)] pub use binary_heap::BinaryHeap; pub use deque::Deque; diff --git a/src/linear_map.rs b/src/linear_map.rs index d096f210a2..f81729306d 100644 --- a/src/linear_map.rs +++ b/src/linear_map.rs @@ -461,15 +461,6 @@ impl<'a, K, V> Clone for Iter<'a, K, V> { } } -impl Drop for LinearMap { - fn drop(&mut self) { - // heapless::Vec implements drop right? - drop(&self.buffer); - // original code below - // unsafe { ptr::drop_in_place(self.buffer.as_mut_slice()) } - } -} - pub struct IterMut<'a, K, V> { iter: slice::IterMut<'a, (K, V)>, }