Skip to content

Commit

Permalink
Actually, one exception to error messages unchanged.
Browse files Browse the repository at this point in the history
Do we even bother making a special case for this ?
  • Loading branch information
Vanille-N committed May 5, 2023
1 parent d7f99bb commit ddb00dd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
13 changes: 11 additions & 2 deletions src/borrow_tracker/tree_borrows/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ impl HistoryData {
);

self.events.push((Some(created.0.data()), msg_creation));
for &Event { transition, access_kind, is_foreign, access_range, span, access_subrange: _ } in &events
for &Event {
transition,
access_kind,
is_foreign,
access_range,
span,
access_subrange: _,
} in &events
{
// NOTE: `access_subrange` is explicitly absent from the error message, it has no significance
// to the user. The meaningful one is `access_range`.
Expand Down Expand Up @@ -205,7 +212,9 @@ impl History {
events: self
.events
.iter()
.filter(|e| e.access_subrange.start <= error_offset && error_offset < e.access_subrange.end)
.filter(|e| {
e.access_subrange.start <= error_offset && error_offset < e.access_subrange.end
})
.cloned()
.collect::<Vec<_>>(),
created: self.created,
Expand Down
12 changes: 9 additions & 3 deletions src/concurrency/data_race.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,8 +859,12 @@ impl VClockAlloc {
if global.race_detecting() {
let (index, mut clocks) = global.current_thread_state_mut(&machine.threads);
let mut alloc_ranges = self.alloc_ranges.borrow_mut();
for (access_subrange, other_range) in alloc_ranges.iter_mut(access_range.start, access_range.size) {
if let Err(DataRace) = other_range.read_race_detect(&mut clocks, index, current_span) {
for (access_subrange, other_range) in
alloc_ranges.iter_mut(access_range.start, access_range.size)
{
if let Err(DataRace) =
other_range.read_race_detect(&mut clocks, index, current_span)
{
drop(clocks);
// Report data-race.
return Self::report_data_race(
Expand Down Expand Up @@ -891,7 +895,9 @@ impl VClockAlloc {
let global = machine.data_race.as_mut().unwrap();
if global.race_detecting() {
let (index, mut clocks) = global.current_thread_state_mut(&machine.threads);
for (access_subrange, other_range) in self.alloc_ranges.get_mut().iter_mut(access_range.start, access_range.size) {
for (access_subrange, other_range) in
self.alloc_ranges.get_mut().iter_mut(access_range.start, access_range.size)
{
if let Err(DataRace) =
other_range.write_race_detect(&mut clocks, index, write_type, current_span)
{
Expand Down
6 changes: 6 additions & 0 deletions tests/fail/tree-borrows/strongly-protected.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ help: the strongly protected tag <TAG> was created here, in the initial state Re
|
LL | fn inner(x: &mut i32, f: fn(&mut i32)) {
| ^
help: the strongly protected tag <TAG> then transitioned from Reserved to Active due to a child write access at offsets [0x0..0x4]
--> $DIR/strongly-protected.rs:LL:CC
|
LL | drop(unsafe { Box::from_raw(raw) });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: this corresponds to an activation
= note: BACKTRACE (of the first span):
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
= note: inside `<std::alloc::Global as std::alloc::Allocator>::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC
Expand Down

0 comments on commit ddb00dd

Please sign in to comment.