- Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.
Description
I tried this code (generated by a fuzzer):
trait A { type Item<'a>; } trait B { type Other<'a>; } impl<T> A for T where for<'a> <T as B>::Other<'a>: Sized, { type Item<'a> = <T as B>::Other<'a>; } impl<T> B for T where for<'a> <T as A>::Item<'a>: Sized, { type Other<'a> = <T as A>::Item<'a>; } fn main() { let _: for<'x> fn(&'x ()) -> <i32 as A>::Item<'x>; }rustc hangs (high CPU usage, no output).
Meta
rustc --version --verbose:
rustc 1.91.1 (ed61e7d7e 2025-11-07) binary: rustc commit-hash: ed61e7d7e242494fb7057f2657300d9e77bb4fcb commit-date: 2025-11-07 host: aarch64-apple-darwin release: 1.91.1 LLVM version: 21.1.2 On macOS, using sample on the rustc process shows it spending all its time in associated-type normalization and trait selection, repeatedly looping in:
- `rustc_trait_selection::traits::normalize::AssocTypeNormalizer::fold_predicate` - `rustc_trait_selection::traits::normalize::normalize_trait_projection` - `rustc_trait_selection::traits::project::opt_normalize_projection_term` - `rustc_trait_selection::traits::select::SelectionContext::select` - `... -> normalize_with_depth_to -> AssocTypeNormalizer::fold_predicate -> ...` (repeats) Metadata
Metadata
Assignees
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.