Skip to content

Commit a477b81

Browse files
committed
Auto merge of #2880 - RalfJung:sync, r=RalfJung
increase timing slack for sync tests; port tests to 2021 edition
2 parents 3d5a516 + 3309f12 commit a477b81

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+115
-35
lines changed

src/tools/miri/tests/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
5252
mode,
5353
program: miri_path(),
5454
quiet: false,
55-
edition: Some("2018".into()),
55+
edition: Some("2021".into()),
5656
..Config::default()
5757
};
5858

src/tools/miri/tests/fail/concurrency/libc_pthread_create_too_few_args.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | panic!()
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `thread_start` at RUSTLIB/std/src/panic.rs:LL:CC
11-
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
10+
= note: inside `thread_start` at RUSTLIB/core/src/panic.rs:LL:CC
11+
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
1212

1313
error: aborting due to previous error
1414

src/tools/miri/tests/fail/concurrency/libc_pthread_create_too_many_args.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | panic!()
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
99
= note: BACKTRACE:
10-
= note: inside `thread_start` at RUSTLIB/std/src/panic.rs:LL:CC
11-
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
10+
= note: inside `thread_start` at RUSTLIB/core/src/panic.rs:LL:CC
11+
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
1212

1313
error: aborting due to previous error
1414

src/tools/miri/tests/fail/data_race/alloc_read_race.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub fn main() {
2626
// 2. write
2727
unsafe {
2828
let j1 = spawn(move || {
29+
let ptr = ptr; // avoid field capturing
2930
// Concurrent allocate the memory.
3031
// Uses relaxed semantics to not generate
3132
// a release sequence.
@@ -34,6 +35,7 @@ pub fn main() {
3435
});
3536

3637
let j2 = spawn(move || {
38+
let ptr = ptr; // avoid field capturing
3739
let pointer = &*ptr.0;
3840

3941
// Note: could also error due to reading uninitialized memory, but the data-race detector triggers first.

src/tools/miri/tests/fail/data_race/alloc_write_race.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub fn main() {
2525
// 2. write
2626
unsafe {
2727
let j1 = spawn(move || {
28+
let ptr = ptr; // avoid field capturing
2829
// Concurrent allocate the memory.
2930
// Uses relaxed semantics to not generate
3031
// a release sequence.
@@ -34,6 +35,7 @@ pub fn main() {
3435
});
3536

3637
let j2 = spawn(move || {
38+
let ptr = ptr; // avoid field capturing
3739
let pointer = &*ptr.0;
3840
*pointer.load(Ordering::Relaxed) = 2; //~ ERROR: Data race detected between (1) Allocate on thread `<unnamed>` and (2) Write on thread `<unnamed>`
3941
});

src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ pub fn main() {
1616
let c = EvilSend(b);
1717
unsafe {
1818
let j1 = spawn(move || {
19+
let c = c; // avoid field capturing
1920
*(c.0 as *mut usize) = 32;
2021
});
2122

2223
let j2 = spawn(move || {
24+
let c = c; // avoid field capturing
2325
(&*c.0).load(Ordering::SeqCst) //~ ERROR: Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Load on thread `<unnamed>`
2426
});
2527

src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ pub fn main() {
1717
let c = EvilSend(b);
1818
unsafe {
1919
let j1 = spawn(move || {
20+
let c = c; // avoid field capturing
2021
let atomic_ref = &mut *c.0;
2122
atomic_ref.load(Ordering::SeqCst)
2223
});
2324

2425
let j2 = spawn(move || {
26+
let c = c; // avoid field capturing
2527
let atomic_ref = &mut *c.0;
2628
*atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) Atomic Load on thread `<unnamed>` and (2) Write on thread `<unnamed>`
2729
});

src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ pub fn main() {
1717
let c = EvilSend(b);
1818
unsafe {
1919
let j1 = spawn(move || {
20+
let c = c; // avoid field capturing
2021
let atomic_ref = &mut *c.0;
2122
atomic_ref.store(32, Ordering::SeqCst)
2223
});
2324

2425
let j2 = spawn(move || {
26+
let c = c; // avoid field capturing
2527
let atomic_ref = &mut *c.0;
2628
*atomic_ref.get_mut() //~ ERROR: Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Read on thread `<unnamed>`
2729
});

src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ pub fn main() {
1616
let c = EvilSend(b);
1717
unsafe {
1818
let j1 = spawn(move || {
19+
let c = c; // avoid field capturing
1920
let _val = *(c.0 as *mut usize);
2021
});
2122

2223
let j2 = spawn(move || {
24+
let c = c; // avoid field capturing
2325
(&*c.0).store(32, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Read on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>`
2426
});
2527

src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ pub fn main() {
1616
let c = EvilSend(b);
1717
unsafe {
1818
let j1 = spawn(move || {
19+
let c = c; // avoid field capturing
1920
*(c.0 as *mut usize) = 32;
2021
});
2122

2223
let j2 = spawn(move || {
24+
let c = c; // avoid field capturing
2325
(&*c.0).store(64, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>`
2426
});
2527

0 commit comments

Comments
 (0)