rust-lang / rust-lang/rust

snapshots sometimes leak inference variables

Open
#122,188 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-cleanup E-hard T-types
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.