Compiler freezes on trait with generic associated type #130640
Open
Description
opened on Sep 20, 2024
I tried this code:
trait What {
type This<'a>: 'a
where
for<'b> Self::This<'b>: 'a + 'b;
}
impl<T> What for T {
type This<'a> = T where T: 'a;
}
I expected to see this happen: The compiler returning with a success (probably not) or a compilation error
Instead, this happened: Compiler freezes, cpu usage shows one core of 100% usage (infinite loop?)
Meta
rustc --version --verbose
:
rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: x86_64-unknown-linux-gnu
release: 1.81.0
LLVM version: 18.1.7
I tried some versions between GATs stabilizing and current nightly, and all had the same behavior.
This could be a duplicate of existing similar issues, but I am not sure if that is the case.
Metadata
Assignees
Labels
Area: Generic associated types (GATs)Area: Associated items (types, constants & functions)Area: Lifetimes / regionsArea: Trait systemCategory: This is a bug.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Relevant to the compiler team, which will review and decide on the PR/issue.Fixed by the next-generation trait solver, `-Znext-solver`.
Activity