-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
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.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team
Description
RFC 1951 disallowed uses of impl Trait within Fn trait sugar or higher-ranked bounds. For example, the following is disallowed:
fn foo(f: impl Fn(impl SomeTrait) -> impl OtherTrait)
fn bar() -> (impl Fn(impl SomeTrait) -> impl OtherTrait)
This tracking issue exists to discuss -- if we were to allow them -- what semantics they ought to have. Some known concerns around the syntax are:
- Should the
()
switch from existential to universal quantification and back?- I think the general feeling here is now "no", basically because "too complex".
- If HRTB were introduced, where would we (e.g.) want
impl OtherTrait
to be bound?
For consistency, we are disallow fn(impl SomeTrait) -> impl OtherTrait
and dyn Fn(impl SomeTrait) -> impl OtherTrait
as well. When considering the questions, one should also consider what the meaning would be in those contexts.
discosultan, TimDiekmann, chpio, jerryc05, Speedy37 and 7 more95th95th and MatrixDev95th and adwher
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.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-langRelevant to the language teamRelevant to the language team