Skip to content

Hang: Compiler hang in resolving Matrix<(), > with GATs [next-solver] #151503

Description

@trait-Cong

I tried this code:(auto-reduce)

trait HasAlias {}
struct Dummy;
trait DummyTrait {
    type DummyType<T>;
}
impl DummyTrait for Dummy {
    type DummyType<T> = T;
}
type AliasOf<T> = <Dummy as DummyTrait>::DummyType<T>;
struct Matrix<T, S>(T, S);
type OMatrix<T> = Matrix<T, AliasOf<T>>;

trait SimdValue {
    type Element;
}
impl<T: HasAlias + SimdValue> SimdValue for OMatrix<T> {
    type Element = OMatrix<T::Element>;
}
trait Unimplemented {}
trait MyFrom<T> {}
impl<T> MyFrom<T> for T {}
impl<T: SimdValue> MyFrom<T> for OMatrix<T::Element> {}
impl<T, S> HasAlias for Matrix<T, S> {}
impl Unimplemented for Matrix<()> {}
fn main() {}

The compiler hangs even with -Z next-solver=globally

Release channel Result
current Stable error
current Nightly (default solver) Hang
Nightly + -Znext-solver=globally Hang

Meta

rustc --version --verbose:

rustc 1.95.0-nightly (eda76d9d1 2026-01-21)
binary: rustc
commit-hash: eda76d9d1d133effbf7facb28168fd78d75fd434
commit-date: 2026-01-21
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8
Backtrace

Hangs.

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 22, 2026
  2. ionicmc-rs commented on Jan 22, 2026

    @ionicmc-rs
    Contributor
  3. ionicmc-rs commented on Jan 22, 2026

    @ionicmc-rs
    Contributor

    Rust analyzer (with nightly) gives a regular error here (hangs after a few checks)

  4. added
    I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.
    WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jan 22, 2026
  5. cyrgani commented on Jan 22, 2026

    @cyrgani
    Contributor

    slightly smaller:

    trait HasAlias {}
    struct Dummy;
    trait DummyTrait {
        type DummyType<T>;
    }
    impl DummyTrait for Dummy {
        type DummyType<T> = T;
    }
    struct Matrix<T, S>(T, S);
    type OMatrix<T> = Matrix<T, <Dummy as DummyTrait>::DummyType<T>>;
    
    trait SimdValue {
        type Element;
    }
    impl<T: HasAlias + SimdValue> SimdValue for OMatrix<T> {
        type Element = OMatrix<T::Element>;
    }
    trait MyFrom<T> {}
    impl<T> MyFrom<T> for T {}
    impl<T: SimdValue> MyFrom<T> for OMatrix<T::Element> {}
    impl<T, S> HasAlias for Matrix<T, S> {}
    fn main() {}
  6. lcnr commented on Oct 8, 2026

    @lcnr
    Contributor

    this now compiles quickly.

    should figure out which PR fixed this, and then add a test.

  7. added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 8, 2026
  8. zakrad commented on Oct 13, 2026

    @zakrad
    Contributor

    @rustbot claim

  9. added a commit that references this issue on Oct 14, 2026
    0782823
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-GATsArea: Generic associated types (GATs)C-bugCategory: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions