Add CI config from main branch, fix build.

This commit is contained in:
Dario Nieuwenhuis 2023-12-04 13:38:13 +01:00
parent 06bd308da4
commit 0a35fbfa7f
6 changed files with 214 additions and 222 deletions

3
.github/bors.toml vendored
View File

@ -1,3 +0,0 @@
block_labels = ["S-blocked"]
delete_merged_branches = true
status = ["ci"]

View File

@ -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
- name: Install Rust with target (${{ matrix.target }})
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
- uses: actions-rs/cargo@v1
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

View File

@ -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

View File

@ -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<T>()
| ------- required by a bound in this
13 | where
14 | T: Send,
| ---- required by this bound in `is_send`
...
19 | is_send::<Consumer<NotSend, 4>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*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<T>()
| ------- 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::<Producer<NotSend, 4>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*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<T>()
| ------- 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::<Queue<NotSend, 4>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely
| ^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely
|
= help: within `Queue<PhantomData<*const ()>, 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<PhantomData<*const ()>>`
= note: required because it appears within the type `MaybeUninit<PhantomData<*const ()>>`
= note: required because it appears within the type `UnsafeCell<MaybeUninit<PhantomData<*const ()>>>`
= help: within `Queue<PhantomData<*const ()>, 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<PhantomData<*const ()>>`
--> $RUST/core/src/mem/manually_drop.rs
note: required because it appears within the type `MaybeUninit<PhantomData<*const ()>>`
--> $RUST/core/src/mem/maybe_uninit.rs
note: required because it appears within the type `UnsafeCell<MaybeUninit<PhantomData<*const ()>>>`
--> $RUST/core/src/cell.rs
= note: required because it appears within the type `[UnsafeCell<MaybeUninit<PhantomData<*const ()>>>; 4]`
= note: required because it appears within the type `Queue<PhantomData<*const ()>, 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<PhantomData<*const ()>, 4>`
--> $HEAPLESS/src/spsc.rs
|
| pub struct Queue<T, const N: usize> {
| ^^^^^
note: required by a bound in `is_send`
--> ui/not-send.rs:14:8
|
12 | fn is_send<T>()
| ------- 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::<Vec<NotSend, 4>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely
| ^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely
|
= help: within `heapless::Vec<PhantomData<*const ()>, 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<PhantomData<*const ()>>`
= note: required because it appears within the type `MaybeUninit<PhantomData<*const ()>>`
= help: within `heapless::Vec<PhantomData<*const ()>, 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<PhantomData<*const ()>>`
--> $RUST/core/src/mem/manually_drop.rs
note: required because it appears within the type `MaybeUninit<PhantomData<*const ()>>`
--> $RUST/core/src/mem/maybe_uninit.rs
= note: required because it appears within the type `[MaybeUninit<PhantomData<*const ()>>; 4]`
= note: required because it appears within the type `heapless::Vec<PhantomData<*const ()>, 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<PhantomData<*const ()>, 4>`
--> $HEAPLESS/src/vec.rs
|
| pub struct Vec<T, const N: usize> {
| ^^^
note: required by a bound in `is_send`
--> ui/not-send.rs:14:8
|
12 | fn is_send<T>()
| ------- 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`
...
23 | is_send::<HistoryBuffer<NotSend, 4>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely
| ^^^^ required by this bound in `is_send`
error[E0277]: `*const ()` cannot be sent between threads safely
--> ui/not-send.rs:23:15
|
= help: within `HistoryBuffer<PhantomData<*const ()>, 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<PhantomData<*const ()>>`
= note: required because it appears within the type `MaybeUninit<PhantomData<*const ()>>`
23 | is_send::<HistoryBuffer<NotSend, 4>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ `*const ()` cannot be sent between threads safely
|
= help: within `HistoryBuffer<PhantomData<*const ()>, 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<PhantomData<*const ()>>`
--> $RUST/core/src/mem/manually_drop.rs
note: required because it appears within the type `MaybeUninit<PhantomData<*const ()>>`
--> $RUST/core/src/mem/maybe_uninit.rs
= note: required because it appears within the type `[MaybeUninit<PhantomData<*const ()>>; 4]`
= note: required because it appears within the type `HistoryBuffer<PhantomData<*const ()>, 4_usize>`
note: required because it appears within the type `HistoryBuffer<PhantomData<*const ()>, 4>`
--> $HEAPLESS/src/histbuf.rs
|
| pub struct HistoryBuffer<T, const N: usize> {
| ^^^^^^^^^^^^^
note: required by a bound in `is_send`
--> ui/not-send.rs:14:8
|
12 | fn is_send<T>()
| ------- required by a bound in this function
13 | where
14 | T: Send,
| ^^^^ required by this bound in `is_send`

View File

@ -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;

View File

@ -461,15 +461,6 @@ impl<'a, K, V> Clone for Iter<'a, K, V> {
}
}
impl<K, V, const N: usize> Drop for LinearMap<K, V, N> {
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)>,
}