Skip to content

Improve tag creation tracking note #1969

Open
@saethlin

Description

@saethlin

I've been looking at a number of Miri errors recently where tracking the relevant tag results in just two messages like the following:

test join ... note: tracking was triggered
  --> /home/ben/futures-rs/futures-task/src/waker_ref.rs:58:16
   |
58 |     let ptr = (&**wake as *const W) as *const ();
   |                ^^^^^^^ created tag 199076
   |
   --> /home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:327:18
    |
327 |         unsafe { &*self.as_ptr() }
    |                  ^^^^^^^^^^^^^^^ trying to reborrow for SharedReadWrite at alloc74291, but parent tag <199076> does not have an appropriate item in the borrow stack
    |

I suspect that in this case the problem is that the created borrow is SRO for an SRW use, or an SRW tag for a Unique use. It would be good if Miri explained a bit more about the tag.

I'd be submitting the PR to do this, but the diagnostic code is a bit displaced from the information about the tag, so improving this requires a bit more finesse with the code than I have patience for today.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-aliasingArea: This affects the aliasing model (Stacked/Tree Borrows)A-diagnosticserrors and warnings emitted by miriC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions