rust-lang / rust-lang/rust

Hang: Trait solver hangs indefinitely with nested struct bounds in where clause

Open
#151,599 0 comments 0 reactions 1 assignee View on GitHub

@cachebag is already working on this.

Since Jan 26, 2026.

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

Description

I tried this code:

trait Stream {}
struct Repeat();
impl<'a> Stream for &  () {}
struct Map<S, F> {
    stream: S,
    func: F,
}
impl<'a, A, F, T> Stream for & mut Map<A, F>
where
    &'a mut A: Stream,
    F: ,
    &'a mut Map<Map, >: Stream,
{}
trait StreamExt
{
    fn mapx<F>(self, ) -> Map<(), F>
    where
        (): ,
        for<'a> &'a  Map<(), F>: Stream,
    {}
}
impl<T> StreamExt for T{}
fn variant1() {
    let source = Repeat();
     map = source.mapx();
}
fn main() {}

Release channel Result
Current Stable Hang
Current Nightly (default solver) Hang
Current Nightly (+ -Znext-solver=globally) error
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
Backtrace

Hang

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.