Skip to content

Hang in trait resolution with and without -Znext-solver #151632

@elimayano

Description

@elimayano

I tried this code:

//@compile-flags: -Znext-solver=globally
trait Foo {}
struct Bar<T>(T);
impl<T> Foo for T
where
    Bar<T>: Foo,
{}

impl<T> Foo for Bar<T> {}
impl<T: Foo> Foo for Bar<T> {}
fn main(){}

Meta

rustc --version --verbose:

rustc 1.95.0-nightly (d222ddc4d 2026-01-23)
binary: rustc
commit-hash: d222ddc4d90743dfc1e53b610be8fc9d95893d2c
commit-date: 2026-01-23
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8
Backtrace

<backtrace>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions