Skip to content

Bad diagnostic when pointer used for deallocation has insufficient Stacked Borrows provenance #2781

Open
@rrichardson

Description

@rrichardson

When running cargo +nightly miri test on my repo (linked below)
I get an error for a deallocation where the tag doesn't exist.

Same result for MIRIFLAGS=-Zmiri-tag-gc=0 cargo +nightly miri test

The code is definitely unsafe, but fairly straightforward with regards to allocations and deallocations. I have verified that there is exactly 1 deallocation for the allocation on the same pointer. That said, I'm not savvy with the techniques for appeasing Miri.

Here is the error output: https://gist.github.com/rrichardson/49f0c94e0cc04491ca7481e0106eb97b

My repo: https://github.com/rrichardson/bytes/tree/refactor-api

Specific offending code: https://github.com/rrichardson/bytes/blob/refactor-api/tests/extern_buf_bytes.rs#L52

Repro Steps:

  1. Clone the repo,
  2. Switch to the refactor-api branch
  3. Run cargo +nightly miri test

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