Skip to content

Possible UB in min_heap #850

@KaiserKarel

Description

@KaiserKarel

Running miri on storage::collections results in the following error:

test collections::binary_heap::tests::min_heap_works ... error: Undefined Behavior: trying to reborrow for SharedReadOnly at alloc1652259+0x4, but parent tag <4076562> does not have an appropriate item in the borrow stack
    --> /home/karel/.rustup/toolchains/nightly-2021-05-06-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:1354:37
     |
1354 |             PartialOrd::partial_cmp(*self, *other)
     |                                     ^^^^^ trying to reborrow for SharedReadOnly at alloc1652259+0x4, but parent tag <4076562> does not have an appropriate item in the borrow stack
     |
     = help: this indicates a potential bug in the program: it performed an invalid operation, but the rules it violated are still experimental
     = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information

I'm working on #847, which requires significant unsafe to implement split_at_mut, so running Miri in CI seems appropriate too,

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions