Skip to content

Hang : rustc hangs/OOMs with infinite recursion #150794

Description

@trait-Cong

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-compilememIssue: Problems and improvements with respect to memory usage during compilation.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions