-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
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
Repro: https://is.gd/nFIian (tried 2017-04-21)
#![feature(step_by)]
#![feature(inclusive_range_syntax)]
fn main() {
let i = (0...10).step_by(3);
assert!(i.size_hint().0 <= i.count());
}
Looks like the implementation is adding one to the Range (exclusive) lower bound, which is incorrect when the size of the base range isn't a multiple of the step.
Thoughts on whether it'd be a better fix to just not add one (correct, but a less-helpful hint) or to add one to end before calling Step::steps_between
(better hint, more math and more overflow cases)?
Metadata
Metadata
Assignees
Labels
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.