Skip to content

We leak inference variables from snapshots #145837

@lcnr

Description

@lcnr

"snapshot vec: index out of bounds" errors happen if we leak inference variables from a probe/in the error of a commit_if_ok.

We create an inference variables inside of the snapshot, revert the snapshot, removing the infer var again, and then try to look it up in the InferCtxt which then causes this ICE. This is already an existing issue and a bunch of diagnostics are really brittle right now, ICEing if you look at them the wrong way. I'Ve tried to fix this in #122189 but didn't end up getting it over the finish line.

Originally posted by @lcnr in #142488

Given that this is such a frequent issue and makes working on diagnostics a more unpleasant than it should be, we should actually do a proper fix here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.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