Open
Description
I tried this code:
pub trait Foo {
type Bar<'a>;
type Baz<'a>;
}
impl Foo for ()
where
T: for<'a> Foo<
Bar<'a> = Self::Bar<'a>,
Baz<'a> = Self::Baz<'a>,
>
{}
I expected to see this happen:
An "overflow evaluating the requirement" error message should be reported. Probably it should generate:
error[E0275]: overflow evaluating the requirement `for<'a> <() as Foo>::Bar<'a> == _`
or
error[E0275]: overflow evaluating the requirement `for<'a> <() as Foo>::Baz<'a> == _`
Or perhaps another specific overflow error for the specific combined requirement it is evaluating.
Instead, this happened:
The compiler reached an endless loop.
Meta
rustc --version --verbose
:
rustc 1.89.0-nightly (ce7e97f73 2025-05-11)
binary: rustc
commit-hash: ce7e97f7371af47e0786f74aa169f6ac9473ff4e
commit-date: 2025-05-11
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.4
Metadata
Metadata
Assignees
Labels
Area: Generic associated types (GATs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Trait systemCategory: This is a bug.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Relevant to the types team, which will review and decide on the PR/issue.Fixed by the next-generation trait solver, `-Znext-solver`.