Skip to content

MIR-borrowck: ICE: broken MIR moving out of Lvalue #44830

Closed
@pnkfelix

Description

@pnkfelix

There are many tests in compile-fail/borrowck/ that ICE with the same failure: "broken MIR moving out of Lvalue"

  • You can see list of such tests in the discrepancy spreadsheet.
  • But for ease of reference, I am also transcribing that list into the first comment on this issue.

pnkfelix believes the origin of this problem is that some code processing MIR (probably MIR dataflow) was written under the assumption that all valid MIR will not have moves out of Lvalues, at least for non-Copy values. But of course such an assumption only holds for MIR that has actually passed the borrowck analysis (at least under our current separation of concerns in the static analyses of rustc), and therefore any dataflow code running prior to borrowck on some (erroneous) Rust source file is going to potentially encounter such MIR.

  • Zoxc has pointed out that it is probably librustc_mir/dataflow/move_paths/builder.rs that is the culprit here.

The answer here is not to panic from rustc, but instead to fail gracefully in some manner and report a nice error diagnostic to the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-borrow-checkerArea: The borrow checkerC-bugCategory: This is a bug.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.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