Description
This is a tracking issue for impl Trait
as output type in Fn
traits in return position of functions, for example fn f() -> impl Fn() -> impl Sized { ... }
.
The feature gate for the issue is #![feature(impl_trait_in_fn_trait_return)]
.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
- Implement the feature (Allow
impl Fn() -> impl Trait
in return position #93582) - Adjust documentation (see instructions on rustc-dev-guide)
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
Questions to be answered in stabilization report (after gaining experience).
Should we allow impl Fn() -> impl Trait
in argument position of functions?
fn f(into_iter_fn: impl Fn() -> impl Iterator) {}
...and what does that desugar to? See discussion here.
Behavior of '_
What is the behavior of '_
in impl trait in general and in this specific case? In this particular case, '_
should be consistent with its use in other function signatures.
Parsing rules
Let's document the parsing behavior and assure ourselves we are happy with it. Some notes here.