Open
Description
It returns Option<size>
: https://doc.rust-lang.org/std/iter/trait.Step.html#tymethod.steps_between
And the comment says it uses None
for overflow: https://doc.rust-lang.org/src/core/iter/range.rs.html#29
But it also uses None
for unimplemented https://doc.rust-lang.org/src/core/iter/range.rs.html#155
And as a result, Range
needs to return (0, None)
when it gets None
: https://doc.rust-lang.org/src/core/iter/range.rs.html#235-240
It would be nice to either
- Require that the method is implemented accurately (easy for fundamental integers; harder if
Step
is expected to support graph walks, but maybe not harder thanPartialOrd
) - Change the type to something else, maybe
Option<Option<usize>>
or be more hint-like with(usize, Option<usize>)
- Something else
cc #42168