Skip to content

rustc hang in Rust for Linux #157516

@ojeda

Description

@ojeda

(Using the new trait solver does not make it hang anymore. I guess it may be a well-known issue with the old one, but I decided to file it for reference.)

I tried this code:

trait Bound {}

trait Alloc {
    const OPS: u32;
}

trait Driver {
    type Object<Ctx: Bound>: Alloc;
}

fn f<T: Driver>() -> u32 {
    T::Object::OPS
}

I expected to see this happen: a compile error.

Instead, this happened: the compiler hangs or gets OOM-killed.

Live: https://godbolt.org/z/e166xq4qo

Original report: https://rust-for-linux.zulipchat.com/#narrow/channel/291565-Help/topic/Do.20we.20have.20anyone.20for.20helping.20triage.20rust.20tooling.20bugs.3F/near/600770020

Meta

rustc --version --verbose:

rustc 1.98.0-nightly (e7815e522 2026-06-04)

It also triggers in e.g. current stable (1.96.0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rust-for-linuxRelevant for the Rust-for-Linux projectA-trait-systemArea: Trait systemC-bugCategory: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.T-typesRelevant to the types 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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions