Types defined with type_alias_impl_trait can be used for dispatch in trait impls. Which is unsound. #84660
Labels
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
A-traits
Area: Trait system
A-typesystem
Area: The type system
C-bug
Category: This is a bug.
F-type_alias_impl_trait
`#[feature(type_alias_impl_trait)]`
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
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.
Let’s define a type:
Well, a straightforward trait implementation does not work:
(playground)
But
rustc
doesn’t complain about anything slighty more complex at the moment, e.g.(playground)
Which turns out to be problematic:
(playground)
Unsurprisingly, this is actually not only resulting in ICEs but also in unsoundness:
(playground)
@rustbot modify labels: A-typesystem, A-traits, A-impl-trait, F-type_alias_impl_trait, T-compiler, requires-nightly
and someone please add “I-unsound 💥”.
The text was updated successfully, but these errors were encountered: