Compiler crash when using impl Trait to bound associated type parameter #47715
Labels
A-associated-items
Area: Associated items (types, constants & functions)
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
C-bug
Category: This is a bug.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
When specifying a trait bound on an associated type with impl Trait the compiler crashes.
I tried this code:
I expected to see this happen: compiler telling me what was wrong with my code 🤔
Instead, this happened: compiler crashed 🔥 💥 😞
thread 'rustc' panicked at 'assertion failed: self.in_band_ty_params.is_empty()', librustc/hir/lowering.rs:555:9
Now I now that I can fix this code by doing
instead of the impl Trait bound. But the actual code has a higher ranked trait bound because lifetimes and when I try the
where
there I geterror[E0212]: cannot extract an associated type from a higher-ranked trait bound in this context
:That was the reason why I started messing with impl Trait.
Meta
rustc --version --verbose
:Backtrace:
The text was updated successfully, but these errors were encountered: