impl Trait in traits
This effort is part of the impl trait initiative. Some notes are kept here as a summary.
Summary
- Able to write
-> impl Trait
in traits - Able to write
type Foo<..> = impl Trait
in impls (type alias impl trait, generic associated types))
Requires
Design notes
Support -> impl Trait
(existential impl trait) in traits. Core idea is to desugar such thing into a (possibly generic) associated type:
We also need to support -> impl Trait
in impls, in which case the body desugars to a "type alias impl trait":
Frequently asked questions
What is the name of that GAT we introduce?
- I called it
Bar
here, but that's somewhat arbitrary, perhaps we want to have some generic syntax for naming the method? - Or for getting the type of the method.
- This problem applies equally to other "
-> impl Trait
in trait" scenarios. - Exploration doc