Skip to content

Commit

Permalink
Merge #184
Browse files Browse the repository at this point in the history
184: Miri has gained some more features r=matklad a=RalfJung

Barriers, concurrency, and spinloops should all work now.

Co-authored-by: Ralf Jung <[email protected]>
  • Loading branch information
bors[bot] and RalfJung authored Jun 26, 2022
2 parents 485aaa8 + b7839ed commit 2cdfc1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/imp_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ mod tests {
}

#[test]
#[cfg(not(miri))]
fn stampede_once() {
static O: OnceCell<()> = OnceCell::new();
static mut RUN: bool = false;
Expand Down
9 changes: 3 additions & 6 deletions tests/it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,10 @@ mod sync {
}

#[test]
#[cfg_attr(miri, ignore)] // miri doesn't support Barrier
fn get_or_init_stress() {
use std::sync::Barrier;
let n_threads = 1_000;
let n_cells = 1_000;
let n_threads = if cfg!(miri) { 30 } else { 1_000 };
let n_cells = if cfg!(miri) { 30 } else { 1_000 };
let cells: Vec<_> = std::iter::repeat_with(|| (Barrier::new(n_threads), OnceCell::new()))
.take(n_cells)
.collect();
Expand Down Expand Up @@ -577,9 +576,8 @@ mod sync {
}

#[test]
#[cfg_attr(miri, ignore)] // FIXME: deadlocks, likely caused by https://github.com/rust-lang/miri/issues/1388
fn once_cell_does_not_leak_partially_constructed_boxes() {
let n_tries = 100;
let n_tries = if cfg!(miri) { 10 } else { 100 };
let n_readers = 10;
let n_writers = 3;
const MSG: &str = "Hello, World";
Expand All @@ -604,7 +602,6 @@ mod sync {
}

#[test]
#[cfg_attr(miri, ignore)] // miri doesn't support Barrier
fn get_does_not_block() {
use std::sync::Barrier;

Expand Down

0 comments on commit 2cdfc1e

Please sign in to comment.