rust-lang / rust-lang/rust

Hang : `rustc` hangs/OOMs with infinite recursion

Open
#150,794 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug fixed-by-next-solver I-compilemem I-hang T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

The compiler hangs and causes a Memory Leak.

I tried this code:

trait Baz: Grault {}
impl Baz for () {}
impl<T> Baz for (T,) {}
trait Fiz {}
impl Fiz for bool {}
trait Grault {
    type A;
    type B;
}
impl<T: Grault> Grault for (T,)
where
    Self::A: Baz,
    Self::B: Fiz,
{
    type A = ();
    type B = bool;
}
fn main() {
    let x: <(_,) as Grault>::A = ();
}
Meta

rustc --version --verbose:

rustc 1.92.0 (ded5c06cf 2025-12-08)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: x86_64-unknown-linux-gnu
release: 1.92.0
LLVM version: 21.1.3
rustc 1.94.0-nightly (e29fcf45e 2026-01-04)
binary: rustc
commit-hash: e29fcf45e4ae686d77b490bf07320f0d3a2cf35f
commit-date: 2026-01-04
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8

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 compiling the provided minimal Rust program with the stable and nightly rustc versions listed, confirming the hang or out-of-memory behavior. Trace the compiler's handling of the recursive trait and associated-type obligations; done means compilation terminates safely and a regression test covers this reproducer.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.