Skip to content

interleave_shortest's size_hint panics with large iterators. #1068

@Takashiidobe

Description

@Takashiidobe

Playground here.

You can create an iterator with interleave_shortest that is longer than usize::MAX. However, since an iterator is lazy, you can use it (I assume you could take usize::MAX items from it at least). When you try to call size_hint on a long iterator created this way however, it panics, even though you can use the iterator itself.

I assume this is a bug in the size_hint method since I don't expect size_hint itself to panic -- it should just give me info. In this case, I would prefer (0, None) instead of panicking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions