Skip to content

Commit 81fe37a

Browse files
committed
Mention and number the components of a race in the order the interpreter sees them
1 parent 19422fc commit 81fe37a

Some content is hidden

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

53 files changed

+113
-113
lines changed

src/tools/miri/src/concurrency/data_race.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -811,15 +811,15 @@ impl VClockAlloc {
811811
Err(err_machine_stop!(TerminationInfo::DataRace {
812812
ptr: ptr_dbg,
813813
op1: RacingOp {
814-
action: action.to_string(),
815-
thread_info: current_thread_info,
816-
span: current_clocks.clock.as_slice()[current_index.index()].span_data(),
817-
},
818-
op2: RacingOp {
819814
action: other_action.to_string(),
820815
thread_info: other_thread_info,
821816
span: other_clock.as_slice()[other_thread.index()].span_data(),
822817
},
818+
op2: RacingOp {
819+
action: action.to_string(),
820+
thread_info: current_thread_info,
821+
span: current_clocks.clock.as_slice()[current_index.index()].span_data(),
822+
},
823823
}))?
824824
}
825825

src/tools/miri/src/diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl fmt::Display for TerminationInfo {
6969
DataRace { ptr, op1, op2 } =>
7070
write!(
7171
f,
72-
"Data race detected between (1) {} on {} and (2) {} on {} at {ptr:?}. (1) just happened here",
72+
"Data race detected between (1) {} on {} and (2) {} on {} at {ptr:?}. (2) just happened here",
7373
op1.action, op1.thread_info, op2.action, op2.thread_info
7474
),
7575
}
@@ -222,9 +222,9 @@ pub fn report_error<'tcx, 'mir>(
222222
vec![(Some(*span), format!("the `{link_name}` symbol is defined here"))],
223223
Int2PtrWithStrictProvenance =>
224224
vec![(None, format!("use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead"))],
225-
DataRace { op2, .. } =>
225+
DataRace { op1, .. } =>
226226
vec![
227-
(Some(op2.span), format!("and (2) occurred earlier here")),
227+
(Some(op1.span), format!("and (1) occurred earlier here")),
228228
(None, format!("this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior")),
229229
(None, format!("see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information")),
230230
],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn main() {
3737
let pointer = &*ptr.0;
3838

3939
// Note: could also error due to reading uninitialized memory, but the data-race detector triggers first.
40-
*pointer.load(Ordering::Relaxed) //~ ERROR: Data race detected between (1) Read on thread `<unnamed>` and (2) Allocate on thread `<unnamed>`
40+
*pointer.load(Ordering::Relaxed) //~ ERROR: Data race detected between (1) Allocate on thread `<unnamed>` and (2) Read on thread `<unnamed>`
4141
});
4242

4343
j1.join().unwrap();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: Undefined Behavior: Data race detected between (1) Read on thread `<unnamed>` and (2) Allocate on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Allocate on thread `<unnamed>` and (2) Read on thread `<unnamed>` at ALLOC. (2) just happened here
22
--> $DIR/alloc_read_race.rs:LL:CC
33
|
44
LL | *pointer.load(Ordering::Relaxed)
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Read on thread `<unnamed>` and (2) Allocate on thread `<unnamed>` at ALLOC. (1) just happened here
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Allocate on thread `<unnamed>` and (2) Read on thread `<unnamed>` at ALLOC. (2) just happened here
66
|
7-
help: and (2) occurred earlier here
7+
help: and (1) occurred earlier here
88
--> $DIR/alloc_read_race.rs:LL:CC
99
|
1010
LL | pointer.store(Box::into_raw(Box::new_uninit()), Ordering::Relaxed);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn main() {
3535

3636
let j2 = spawn(move || {
3737
let pointer = &*ptr.0;
38-
*pointer.load(Ordering::Relaxed) = 2; //~ ERROR: Data race detected between (1) Write on thread `<unnamed>` and (2) Allocate on thread `<unnamed>`
38+
*pointer.load(Ordering::Relaxed) = 2; //~ ERROR: Data race detected between (1) Allocate on thread `<unnamed>` and (2) Write on thread `<unnamed>`
3939
});
4040

4141
j1.join().unwrap();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: Undefined Behavior: Data race detected between (1) Write on thread `<unnamed>` and (2) Allocate on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Allocate on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (2) just happened here
22
--> $DIR/alloc_write_race.rs:LL:CC
33
|
44
LL | *pointer.load(Ordering::Relaxed) = 2;
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `<unnamed>` and (2) Allocate on thread `<unnamed>` at ALLOC. (1) just happened here
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Allocate on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (2) just happened here
66
|
7-
help: and (2) occurred earlier here
7+
help: and (1) occurred earlier here
88
--> $DIR/alloc_write_race.rs:LL:CC
99
|
1010
LL | .store(Box::into_raw(Box::<usize>::new_uninit()) as *mut usize, Ordering::Relaxed);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn main() {
2020
});
2121

2222
let j2 = spawn(move || {
23-
(&*c.0).load(Ordering::SeqCst) //~ ERROR: Data race detected between (1) Atomic Load on thread `<unnamed>` and (2) Write on thread `<unnamed>`
23+
(&*c.0).load(Ordering::SeqCst) //~ ERROR: Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Load on thread `<unnamed>`
2424
});
2525

2626
j1.join().unwrap();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: Undefined Behavior: Data race detected between (1) Atomic Load on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Load on thread `<unnamed>` at ALLOC. (2) just happened here
22
--> $DIR/atomic_read_na_write_race1.rs:LL:CC
33
|
44
LL | (&*c.0).load(Ordering::SeqCst)
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Load on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (1) just happened here
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Load on thread `<unnamed>` at ALLOC. (2) just happened here
66
|
7-
help: and (2) occurred earlier here
7+
help: and (1) occurred earlier here
88
--> $DIR/atomic_read_na_write_race1.rs:LL:CC
99
|
1010
LL | *(c.0 as *mut usize) = 32;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn main() {
2323

2424
let j2 = spawn(move || {
2525
let atomic_ref = &mut *c.0;
26-
*atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Load on thread `<unnamed>`
26+
*atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) Atomic Load on thread `<unnamed>` and (2) Write on thread `<unnamed>`
2727
});
2828

2929
j1.join().unwrap();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: Undefined Behavior: Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Load on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Atomic Load on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (2) just happened here
22
--> $DIR/atomic_read_na_write_race2.rs:LL:CC
33
|
44
LL | *atomic_ref.get_mut() = 32;
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Load on thread `<unnamed>` at ALLOC. (1) just happened here
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Load on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (2) just happened here
66
|
7-
help: and (2) occurred earlier here
7+
help: and (1) occurred earlier here
88
--> $DIR/atomic_read_na_write_race2.rs:LL:CC
99
|
1010
LL | atomic_ref.load(Ordering::SeqCst)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn main() {
2323

2424
let j2 = spawn(move || {
2525
let atomic_ref = &mut *c.0;
26-
*atomic_ref.get_mut() //~ ERROR: Data race detected between (1) Read on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>`
26+
*atomic_ref.get_mut() //~ ERROR: Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Read on thread `<unnamed>`
2727
});
2828

2929
j1.join().unwrap();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: Undefined Behavior: Data race detected between (1) Read on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Read on thread `<unnamed>` at ALLOC. (2) just happened here
22
--> $DIR/atomic_write_na_read_race1.rs:LL:CC
33
|
44
LL | *atomic_ref.get_mut()
5-
| ^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Read on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>` at ALLOC. (1) just happened here
5+
| ^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Read on thread `<unnamed>` at ALLOC. (2) just happened here
66
|
7-
help: and (2) occurred earlier here
7+
help: and (1) occurred earlier here
88
--> $DIR/atomic_write_na_read_race1.rs:LL:CC
99
|
1010
LL | atomic_ref.store(32, Ordering::SeqCst)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn main() {
2020
});
2121

2222
let j2 = spawn(move || {
23-
(&*c.0).store(32, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Read on thread `<unnamed>`
23+
(&*c.0).store(32, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Read on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>`
2424
});
2525

2626
j1.join().unwrap();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: Undefined Behavior: Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Read on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Read on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>` at ALLOC. (2) just happened here
22
--> $DIR/atomic_write_na_read_race2.rs:LL:CC
33
|
44
LL | (&*c.0).store(32, Ordering::SeqCst);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Read on thread `<unnamed>` at ALLOC. (1) just happened here
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Read on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>` at ALLOC. (2) just happened here
66
|
7-
help: and (2) occurred earlier here
7+
help: and (1) occurred earlier here
88
--> $DIR/atomic_write_na_read_race2.rs:LL:CC
99
|
1010
LL | let _val = *(c.0 as *mut usize);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn main() {
2020
});
2121

2222
let j2 = spawn(move || {
23-
(&*c.0).store(64, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Write on thread `<unnamed>`
23+
(&*c.0).store(64, Ordering::SeqCst); //~ ERROR: Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>`
2424
});
2525

2626
j1.join().unwrap();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: Undefined Behavior: Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>` at ALLOC. (2) just happened here
22
--> $DIR/atomic_write_na_write_race1.rs:LL:CC
33
|
44
LL | (&*c.0).store(64, Ordering::SeqCst);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (1) just happened here
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>` at ALLOC. (2) just happened here
66
|
7-
help: and (2) occurred earlier here
7+
help: and (1) occurred earlier here
88
--> $DIR/atomic_write_na_write_race1.rs:LL:CC
99
|
1010
LL | *(c.0 as *mut usize) = 32;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn main() {
2323

2424
let j2 = spawn(move || {
2525
let atomic_ref = &mut *c.0;
26-
*atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>`
26+
*atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Write on thread `<unnamed>`
2727
});
2828

2929
j1.join().unwrap();

src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: Undefined Behavior: Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (2) just happened here
22
--> $DIR/atomic_write_na_write_race2.rs:LL:CC
33
|
44
LL | *atomic_ref.get_mut() = 32;
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Write on thread `<unnamed>` and (2) Atomic Store on thread `<unnamed>` at ALLOC. (1) just happened here
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) Atomic Store on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (2) just happened here
66
|
7-
help: and (2) occurred earlier here
7+
help: and (1) occurred earlier here
88
--> $DIR/atomic_write_na_write_race2.rs:LL:CC
99
|
1010
LL | atomic_ref.store(64, Ordering::SeqCst);

src/tools/miri/tests/fail/data_race/dangling_thread_async_race.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: Undefined Behavior: Data race detected between (1) Write on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Write on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (2) just happened here
22
--> $DIR/dangling_thread_async_race.rs:LL:CC
33
|
44
LL | *c.0 = 64;
5-
| ^^^^^^^^^ Data race detected between (1) Write on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (1) just happened here
5+
| ^^^^^^^^^ Data race detected between (1) Write on thread `<unnamed>` and (2) Write on thread `<unnamed>` at ALLOC. (2) just happened here
66
|
7-
help: and (2) occurred earlier here
7+
help: and (1) occurred earlier here
88
--> $DIR/dangling_thread_async_race.rs:LL:CC
99
|
1010
LL | *c.0 = 32;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ fn main() {
3333
spawn(|| ()).join().unwrap();
3434

3535
unsafe {
36-
*c.0 = 64; //~ ERROR: Data race detected between (1) Write on thread `main` and (2) Write on thread `<unnamed>`
36+
*c.0 = 64; //~ ERROR: Data race detected between (1) Write on thread `<unnamed>` and (2) Write on thread `main`
3737
}
3838
}

src/tools/miri/tests/fail/data_race/dangling_thread_race.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: Undefined Behavior: Data race detected between (1) Write on thread `main` and (2) Write on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Write on thread `<unnamed>` and (2) Write on thread `main` at ALLOC. (2) just happened here
22
--> $DIR/dangling_thread_race.rs:LL:CC
33
|
44
LL | *c.0 = 64;
5-
| ^^^^^^^^^ Data race detected between (1) Write on thread `main` and (2) Write on thread `<unnamed>` at ALLOC. (1) just happened here
5+
| ^^^^^^^^^ Data race detected between (1) Write on thread `<unnamed>` and (2) Write on thread `main` at ALLOC. (2) just happened here
66
|
7-
help: and (2) occurred earlier here
7+
help: and (1) occurred earlier here
88
--> $DIR/dangling_thread_race.rs:LL:CC
99
|
1010
LL | *c.0 = 32;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn main() {
2525

2626
let j2 = spawn(move || {
2727
__rust_dealloc(
28-
//~^ ERROR: Data race detected between (1) Deallocate on thread `<unnamed>` and (2) Read on thread `<unnamed>`
28+
//~^ ERROR: Data race detected between (1) Read on thread `<unnamed>` and (2) Deallocate on thread `<unnamed>`
2929
ptr.0 as *mut _,
3030
std::mem::size_of::<usize>(),
3131
std::mem::align_of::<usize>(),

src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: Undefined Behavior: Data race detected between (1) Deallocate on thread `<unnamed>` and (2) Read on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Read on thread `<unnamed>` and (2) Deallocate on thread `<unnamed>` at ALLOC. (2) just happened here
22
--> $DIR/dealloc_read_race1.rs:LL:CC
33
|
44
LL | / __rust_dealloc(
@@ -7,9 +7,9 @@ LL | | ptr.0 as *mut _,
77
LL | | std::mem::size_of::<usize>(),
88
LL | | std::mem::align_of::<usize>(),
99
LL | | );
10-
| |_____________^ Data race detected between (1) Deallocate on thread `<unnamed>` and (2) Read on thread `<unnamed>` at ALLOC. (1) just happened here
10+
| |_____________^ Data race detected between (1) Read on thread `<unnamed>` and (2) Deallocate on thread `<unnamed>` at ALLOC. (2) just happened here
1111
|
12-
help: and (2) occurred earlier here
12+
help: and (1) occurred earlier here
1313
--> $DIR/dealloc_read_race1.rs:LL:CC
1414
|
1515
LL | let _val = *ptr.0;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn main() {
2828
});
2929

3030
let j2 = spawn(move || {
31-
// Also an error of the form: Data race detected between (1) Read on thread `<unnamed>` and (2) Deallocate on thread `<unnamed>`
31+
// Also an error of the form: Data race detected between (1) Deallocate on thread `<unnamed>` and (2) Read on thread `<unnamed>`
3232
// but the invalid allocation is detected first.
3333
*ptr.0 //~ ERROR: dereferenced after this allocation got freed
3434
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn main() {
3535
sleep(Duration::from_millis(200));
3636

3737
// Now `stack_var` gets deallocated.
38-
} //~ ERROR: Data race detected between (1) Deallocate on thread `<unnamed>` and (2) Read on thread `<unnamed>`
38+
} //~ ERROR: Data race detected between (1) Read on thread `<unnamed>` and (2) Deallocate on thread `<unnamed>`
3939
});
4040

4141
let j2 = spawn(move || {

src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: Undefined Behavior: Data race detected between (1) Deallocate on thread `<unnamed>` and (2) Read on thread `<unnamed>` at ALLOC. (1) just happened here
1+
error: Undefined Behavior: Data race detected between (1) Read on thread `<unnamed>` and (2) Deallocate on thread `<unnamed>` at ALLOC. (2) just happened here
22
--> $DIR/dealloc_read_race_stack.rs:LL:CC
33
|
44
LL | }
5-
| ^ Data race detected between (1) Deallocate on thread `<unnamed>` and (2) Read on thread `<unnamed>` at ALLOC. (1) just happened here
5+
| ^ Data race detected between (1) Read on thread `<unnamed>` and (2) Deallocate on thread `<unnamed>` at ALLOC. (2) just happened here
66
|
7-
help: and (2) occurred earlier here
7+
help: and (1) occurred earlier here
88
--> $DIR/dealloc_read_race_stack.rs:LL:CC
99
|
1010
LL | *pointer.load(Ordering::Acquire)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn main() {
2424

2525
let j2 = spawn(move || {
2626
__rust_dealloc(
27-
//~^ ERROR: Data race detected between (1) Deallocate on thread `<unnamed>` and (2) Write on thread `<unnamed>`
27+
//~^ ERROR: Data race detected between (1) Write on thread `<unnamed>` and (2) Deallocate on thread `<unnamed>`
2828
ptr.0 as *mut _,
2929
std::mem::size_of::<usize>(),
3030
std::mem::align_of::<usize>(),

0 commit comments

Comments
 (0)