rust-lang / rust-lang/rust

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

Open
#151,503 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-GATs C-bug I-hang needs-triage T-compiler WG-trait-system-refactor
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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.

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 reduced Rust example and compare the default solver with -Znext-solver=globally, confirming the hang on the reported nightly version. Trace the compiler's trait-solving path for the GAT alias, overlapping MyFrom implementations, and Matrix bounds; done means the reproducer terminates without introducing incorrect diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.