Skip to content

RangeFrom iterator overflows when it gets to the maximum value of the type #25696

Closed
@Aatch

Description

@Aatch

So if you have (0u8..) and iterate over it, it will keep going forever (in a release build anyway), producing 0, 1, 2, ... 255, 0, 1, 2, ...

That is unexpected. It also panics in a debug build, so I assume it's also not intentional. I propose that instead of overflowing, the iterator instead returns None.

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