Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There should be a way to count backwards with a step using a range #23588

Closed
crumblingstatue opened this issue Mar 21, 2015 · 2 comments
Closed

Comments

@crumblingstatue
Copy link
Contributor

fn main() {
    for i in (0..10).step_by(2).rev() {
        println!("{}", i);
    }
}

produces the following error:

error: the trait `core::iter::DoubleEndedIterator` is not implemented for the type `core::iter::StepBy<_, core::ops::Range<_>>` [E0277]

Perhaps step_by() could produce a DoubleEndedIterator on ranges that are double-ended, but I don't know if this is possible.

@alexcrichton
Copy link
Member

cc @aturon

@steveklabnik
Copy link
Member

#27741 has superceded this issue, so closing in favor of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants