ICE on unsound usage of existential types #52843
Labels
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
C-bug
Category: This is a bug.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
F-type_alias_impl_trait
`#[feature(type_alias_impl_trait)]`
glacier
ICE tracked in rust-lang/glacier.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-nightly
This issue requires a nightly compiler in some way.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
You can construct an existential type that implements traits that it shouldn't have like so:
Playground
As you can see Foo's type parameter T doesn't have a Default bound, but it still implements the Default trait as a whole. If you actually abuse this with a type parameter that doesn't implement Default, you can construct a value even though the type doesn't implement Default. This results in an ICE atm:
This may just be an unimplemented check due to existential types being brand new on nightly.
The text was updated successfully, but these errors were encountered: