Closed
Description
(Part of #34511)
As part of the latest impl Trait
RFC, we decided to accept impl Trait
in argument position:
fn foo(x: impl Iterator<Item = u32>) {
...
}
this is roughly equivalent to fn foo<T: Iterator<Item = u32>>(t: T)
, except that explicitly specifying the type is not permitted (i.e., foo::<u32>
is an error).
Mentoring instructions can be found here.
Questions to resolve:
- Should we permit specifying types if some parameters are implicit and some are explicit? e.g.,
fn foo<T>(x: impl Iterator<Item = T>>)
? I think yes,foo::<u32>
would be accepted (thus bindingT = u32
explicitly).- Answer: for now, just forbid explicit bindings altogether in the presence of
impl Trait
arguments.
- Answer: for now, just forbid explicit bindings altogether in the presence of
Metadata
Metadata
Assignees
Labels
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Category: An issue tracking the progress of sth. like the implementation of an RFCCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Relevant to the compiler team, which will review and decide on the PR/issue.Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804