Skip to content

IteratorExt::rev should be bounded by DoubleEndedIterator #23587

Closed
@crumblingstatue

Description

@crumblingstatue
fn main() {
    (0..10).step_by(2).rev().next();
}

produces the following error:

error: type `core::iter::Rev<core::iter::StepBy<_, core::ops::Range<_>>>` does not implement any method in scope named `next`

According to @eddyb, IteratorExt::rev should be bounded by DoubleEndedIterator to prevent this.

EDIT: Updated the example to show the correct error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions