Skip to content

Commit ddb00dd

Browse files
committed
Actually, one exception to error messages unchanged.
Do we even bother making a special case for this ?
1 parent d7f99bb commit ddb00dd

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

src/borrow_tracker/tree_borrows/diagnostics.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,14 @@ impl HistoryData {
7676
);
7777

7878
self.events.push((Some(created.0.data()), msg_creation));
79-
for &Event { transition, access_kind, is_foreign, access_range, span, access_subrange: _ } in &events
79+
for &Event {
80+
transition,
81+
access_kind,
82+
is_foreign,
83+
access_range,
84+
span,
85+
access_subrange: _,
86+
} in &events
8087
{
8188
// NOTE: `access_subrange` is explicitly absent from the error message, it has no significance
8289
// to the user. The meaningful one is `access_range`.
@@ -205,7 +212,9 @@ impl History {
205212
events: self
206213
.events
207214
.iter()
208-
.filter(|e| e.access_subrange.start <= error_offset && error_offset < e.access_subrange.end)
215+
.filter(|e| {
216+
e.access_subrange.start <= error_offset && error_offset < e.access_subrange.end
217+
})
209218
.cloned()
210219
.collect::<Vec<_>>(),
211220
created: self.created,

src/concurrency/data_race.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -859,8 +859,12 @@ impl VClockAlloc {
859859
if global.race_detecting() {
860860
let (index, mut clocks) = global.current_thread_state_mut(&machine.threads);
861861
let mut alloc_ranges = self.alloc_ranges.borrow_mut();
862-
for (access_subrange, other_range) in alloc_ranges.iter_mut(access_range.start, access_range.size) {
863-
if let Err(DataRace) = other_range.read_race_detect(&mut clocks, index, current_span) {
862+
for (access_subrange, other_range) in
863+
alloc_ranges.iter_mut(access_range.start, access_range.size)
864+
{
865+
if let Err(DataRace) =
866+
other_range.read_race_detect(&mut clocks, index, current_span)
867+
{
864868
drop(clocks);
865869
// Report data-race.
866870
return Self::report_data_race(
@@ -891,7 +895,9 @@ impl VClockAlloc {
891895
let global = machine.data_race.as_mut().unwrap();
892896
if global.race_detecting() {
893897
let (index, mut clocks) = global.current_thread_state_mut(&machine.threads);
894-
for (access_subrange, other_range) in self.alloc_ranges.get_mut().iter_mut(access_range.start, access_range.size) {
898+
for (access_subrange, other_range) in
899+
self.alloc_ranges.get_mut().iter_mut(access_range.start, access_range.size)
900+
{
895901
if let Err(DataRace) =
896902
other_range.write_race_detect(&mut clocks, index, write_type, current_span)
897903
{

tests/fail/tree-borrows/strongly-protected.stderr

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ help: the strongly protected tag <TAG> was created here, in the initial state Re
1717
|
1818
LL | fn inner(x: &mut i32, f: fn(&mut i32)) {
1919
| ^
20+
help: the strongly protected tag <TAG> then transitioned from Reserved to Active due to a child write access at offsets [0x0..0x4]
21+
--> $DIR/strongly-protected.rs:LL:CC
22+
|
23+
LL | drop(unsafe { Box::from_raw(raw) });
24+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25+
= help: this corresponds to an activation
2026
= note: BACKTRACE (of the first span):
2127
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
2228
= note: inside `<std::alloc::Global as std::alloc::Allocator>::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC

0 commit comments

Comments
 (0)