Skip to content

rustc panics on compile-fail/borrowck/two-phase-reservation-sharing-interference #50128

Closed
@cuviper

Description

@cuviper

This is another non-ICE panic revealed by #49891:

$ rustc +dev1 src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference.rs -Z borrowck=mir -Z two-phase-borrows -Z two-phase-beyond-autoref
error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable
  --> src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference.rs:46:9
   |
41 |         let shared = &vec;
   |                      ---- immutable borrow occurs here
...
46 |         delay = &mut vec;
   |         ^^^^^^^^^^^^^^^^ mutable borrow occurs here
...
50 |         shared[0];
   |         ------ borrow later used here

thread 'main' panicked at 'assertion failed: match borrow.kind {{
    BorrowKind::Shared => false,
    BorrowKind::Unique | BorrowKind::Mut {{ .. }} => true,
}}', librustc_mir/borrow_check/mod.rs:1252:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: aborting due to previous error

For more information about this error, try `rustc --explain E0502`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)A-borrow-checkerArea: The borrow checkerC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions