Skip to content

MIR-borrowck: ICE: could not find BorrowIndexs for region scope #44828

Closed
@pnkfelix

Description

@pnkfelix

There are many tests in compile-fail/borrowck/ that ICE with the same failure: "could not find BorrowIndexes for region scope ..."

  • 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.

My suspicion is that all of these are arising due to dataflow attempting to look up a region in a const-promoted MIR fragment (e.g. for the body of a closure is the common case, I think). Before promotion the MIR in question had references to regions that actually corresponded to some borrow within the same MIR. (And originally MIR-borrowck was running before const-promotion, which is why I did not address the problem during the original development.)

But someone should of course confirm the above hypothesis.

Assuming that hypothesis holds, the next step would be to actually fix the problem in some reasonable way. One way would be to rewrite the MIR during promotion, replacing the regions in question. But another, probably simpler (and more efficient) way to fix this could be to just make the dataflow code assume that such regions always correspond to something that spans the entirety of the MIR being analyzed. (That fix definitely requires that we confirm the above hypothesis is the only reason this ICE is arising.)

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