Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a7c832b

Browse files
cbeuwRalfJung
andcommitted
Wording improvements
Co-authored-by: Ralf Jung <[email protected]>
1 parent 6a73ded commit a7c832b

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/concurrency/weak_memory.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,9 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
417417
&& !alloc_clocks
418418
.read_race_free_with_atomic(range, this.machine.data_race.as_ref().unwrap())
419419
{
420-
throw_ub_format!("racy imperfectly overlapping atomic access");
420+
throw_ub_format!(
421+
"racy imperfectly overlapping atomic access is not possible in the C++20 memory model"
422+
);
421423
}
422424
}
423425
Ok(())

src/machine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
743743
if let Some(weak_memory) = &alloc_extra.weak_memory {
744744
if !machine.data_race.as_ref().unwrap().ongoing_atomic_access() {
745745
// This is a non-atomic access. And if we are accessing a previously atomically
746-
// accessed location without racing with them, then the location no longer needs
747-
// to exhibit weak-memory behaviours until a fresh atomic access happens
746+
// accessed location without racing with them, then the location no longer
747+
// exhibits weak-memory behaviors until a fresh atomic access happens.
748748
weak_memory.destroy_atomicity(range);
749749
}
750750
}

tests/compile-fail/weak_memory/racing_mixed_size.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
warning: thread support is experimental: the scheduler is not preemptive, and can get stuck in spin loops.
22
(see https://github.com/rust-lang/miri/issues/1388)
33

4-
error: Undefined Behavior: racy imperfectly overlapping atomic access
4+
error: Undefined Behavior: racy imperfectly overlapping atomic access is not possible in the C++20 memory model
55
--> $DIR/racing_mixed_size.rs:LL:CC
66
|
77
LL | std::intrinsics::atomic_load_relaxed(hi);
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ racy imperfectly overlapping atomic access
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ racy imperfectly overlapping atomic access is not possible in the C++20 memory model
99
|
1010
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
1111
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/run-pass/weak_memory/extra_cpp_unsafe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn racing_mixed_size_read() {
6262
j2.join().unwrap();
6363
}
6464

65-
// And the combination of both of above
65+
// And we allow the combination of both of the above.
6666
fn racing_mixed_atomicity_and_size_read() {
6767
let x = static_atomic(u32::from_be(0xabbafafa));
6868

0 commit comments

Comments
 (0)