snapshots sometimes leak inference variables
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
When using InferCtxt::probe/commit_if_ok, we discard all inference variables created inside of this snapshot. This means that returning a type containing inference variables from it can later result in ICE if we try to access them.
This should not happen and we should protect ourselves from doing so in the future. cc https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/leaking.20infer.20vars.20from.20snapshots
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing rustc's InferCtxt::probe and commit_if_ok snapshot handling, focusing on how inference variables created inside a snapshot are discarded. Look for existing tests covering snapshot results and add regression coverage that prevents returned types from retaining invalid variables; done means the scenario no longer causes an ICE.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100