Skip to content

Overflow in Range<A> size_hint()  #24851

Closed
@bluss

Description

@bluss

size_hint is not implemented correctly for the ranges, it overflows:

playbot: (-1i8..127).size_hint()
-playbot:#rust-internals- (18446744073709551488, Some(18446744073709551488))

Expected result: 128

With other compilation settings, the result is:

'Error: arithmetic operation overflowed'

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