Skip to content

Commit be09a10

Browse files
committed
data_race: link to docs for 'unusual' race conditions
1 parent 2ef639d commit be09a10

7 files changed

+8
-1
lines changed

src/tools/miri/src/diagnostics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ pub fn report_error<'tcx, 'mir>(
270270
DataRace { op1, extra, .. } => {
271271
let mut helps = vec![(Some(op1.span), format!("and (1) occurred earlier here"))];
272272
if let Some(extra) = extra {
273-
helps.push((None, format!("{extra}")))
273+
helps.push((None, format!("{extra}")));
274+
helps.push((None, format!("see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model")));
274275
}
275276
helps.push((None, format!("this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior")));
276277
helps.push((None, format!("see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information")));

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ help: and (1) occurred earlier here
1010
LL | a16.load(Ordering::SeqCst);
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
= help: overlapping unsynchronized atomic accesses must use the same access size
13+
= help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model
1314
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
1415
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
1516
= note: BACKTRACE (of the first span):

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ help: and (1) occurred earlier here
1010
LL | a16.store(1, Ordering::SeqCst);
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
= help: overlapping unsynchronized atomic accesses must use the same access size
13+
= help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model
1314
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
1415
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
1516
= note: BACKTRACE (of the first span):

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ help: and (1) occurred earlier here
1010
LL | unsafe { ptr.read() };
1111
| ^^^^^^^^^^
1212
= help: overlapping atomic and non-atomic accesses must be synchronized, even if both are read-only
13+
= help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model
1314
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
1415
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
1516
= note: BACKTRACE (of the first span):

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ help: and (1) occurred earlier here
1010
LL | a.load(Ordering::SeqCst);
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^
1212
= help: overlapping atomic and non-atomic accesses must be synchronized, even if both are read-only
13+
= help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model
1314
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
1415
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
1516
= note: BACKTRACE (of the first span):

src/tools/miri/tests/fail/weak_memory/racing_mixed_size.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ help: and (1) occurred earlier here
1010
LL | x.store(1, Relaxed);
1111
| ^^^^^^^^^^^^^^^^^^^
1212
= help: overlapping unsynchronized atomic accesses must use the same access size
13+
= help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model
1314
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
1415
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
1516
= note: BACKTRACE (of the first span):

src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ help: and (1) occurred earlier here
1010
LL | x.load(Relaxed);
1111
| ^^^^^^^^^^^^^^^
1212
= help: overlapping unsynchronized atomic accesses must use the same access size
13+
= help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model
1314
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
1415
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
1516
= note: BACKTRACE (of the first span):

0 commit comments

Comments
 (0)