-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
ICE combining universal plus existential impl Trait #46685
Copy link
Copy link
Closed
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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.
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The following program will ICE:
The problem derives from the fact that universal impl traits, during HIR lowering, do not generate entries in the
hir::Genericsstructure -- they are synthesized after the fact, in thety::Generics. This interferes with theresolve_lifetimecode, which expects to use the HIR generics to determine the indices of things.I'm not sure the best fix here. The easiest fix is probably to count the number of universal impl traits and take them into account in
resolve_lifetime. The best fix feels like it would be to actually insert the type parameters for universal impl trait instances intohir::Generics.cc @cramertj @chrisvittal