Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[impl Trait] Should we allow `impl Trait` after `->` in `fn` types or parentheses sugar? #45994
Comments
nikomatsakis
added
the
T-lang
label
Nov 15, 2017
aturon
referenced this issue
Nov 15, 2017
Open
Tracking issue for `impl Trait` (RFC 1522, RFC 1951, RFC 2071) #34511
XAMPPRocky
added
C-enhancement
A-impl-trait
labels
Feb 19, 2018
This comment has been minimized.
This comment has been minimized.
How is |
This comment has been minimized.
This comment has been minimized.
I meant
would desugar to
Of course -- as you righly point out -- if the |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis I see, thanks for the clarification! |
nikomatsakis commentedNov 15, 2017
RFC 1951 disallowed uses of impl Trait within Fn trait sugar or higher-ranked bounds. For example, the following is disallowed:
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:
()switch from existential to universal quantification and back?impl OtherTraitto be bound?For consistency, we are disallow
fn(impl SomeTrait) -> impl OtherTraitanddyn Fn(impl SomeTrait) -> impl OtherTraitas well. When considering the questions, one should also consider what the meaning would be in those contexts.