-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
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
Stepis 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
schneiderfelipeschneiderfelipe
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.