-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Nested impl Trait for higher-order functions #76410
Copy link
Copy link
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-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.
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-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Hi!
It will be nice to use impl Trait with higher-order functions like the following. But it occurs a compile error at
impl Iterator<Item=u32>.Nested impl Trait: https://doc.rust-lang.org/error-index.html#E0666
expected behavior/work around
Here is an expected behavior and a work around. We need to write the type explicitly like
std::iter::Map<std::ops::Range<u32>, F>instead ofimpl Iterator<Item=u32>.Rust Playground
The output should be the following.
It will be harder to write and read the return type when we append other methods after the
.map(f).