Skip to content

Commit

Permalink
Customize tests for Miri & add Miri to CI
Browse files Browse the repository at this point in the history
Closes issue #7.
  • Loading branch information
sbarral committed Apr 22, 2024
1 parent 9534cdd commit fb6e4f9
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 81 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@ jobs:
LOOM_MAX_PREEMPTIONS: 3
RUSTFLAGS: --cfg st3_loom

miri:
name: Miri
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: miri

- name: Run cargo miri
run: cargo miri test
env:
MIRIFLAGS: -Zmiri-strict-provenance

lints:
name: Lints
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions src/fifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use alloc::sync::Arc;

use core::alloc::Layout;
use core::iter::FusedIterator;
use core::mem::{drop, transmute, MaybeUninit};
use core::mem::{transmute, MaybeUninit};
use core::panic::{RefUnwindSafe, UnwindSafe};
use core::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};

Expand Down Expand Up @@ -280,8 +280,8 @@ impl<T> Worker<T> {
/// can in particular be used to perform a cheap equality check with another
/// `Stealer` and verify that it is associated to the same `Worker`.
pub fn stealer_ref(&self) -> &Stealer<T> {
// Sanity checks to assess that `queue` has indeed the size and
// alignment of a `Stealer` (this assert is optimized in release mode).
// Sanity check to assess that `queue` has indeed the size and alignment
// of a `Stealer` (this assert is optimized away in release mode).
assert_eq!(Layout::for_value(&self.queue), Layout::new::<Stealer<T>>());

// Safety: `self.queue` has the size and alignment of `Stealer` since
Expand Down
6 changes: 3 additions & 3 deletions src/lifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use alloc::sync::Arc;

use core::alloc::Layout;
use core::iter::FusedIterator;
use core::mem::{drop, transmute, MaybeUninit};
use core::mem::{transmute, MaybeUninit};
use core::panic::{RefUnwindSafe, UnwindSafe};
use core::sync::atomic::Ordering::{Acquire, Relaxed, Release};

Expand Down Expand Up @@ -324,8 +324,8 @@ impl<T> Worker<T> {
/// can in particular be used to perform a cheap equality check with another
/// `Stealer` and verify that it is associated to the same `Worker`.
pub fn stealer_ref(&self) -> &Stealer<T> {
// Sanity checks to assess that `queue` has indeed the size and
// alignment of a `Stealer` (this assert is optimized in release mode).
// Sanity check to assess that `queue` has indeed the size and alignment
// of a `Stealer` (this assert is optimized away in release mode).
assert_eq!(Layout::for_value(&self.queue), Layout::new::<Stealer<T>>());

// Safety: `self.queue` has the size and alignment of `Stealer` since
Expand Down
Loading

0 comments on commit fb6e4f9

Please sign in to comment.