Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7b3dc62

Browse files
committedSep 26, 2024·
Fixed bug
1 parent 0cdca2c commit 7b3dc62

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎library/core/src/iter/range.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,11 @@ impl<A: Step> Iterator for ops::Range<A> {
849849

850850
#[inline]
851851
fn size_hint(&self) -> (usize, Option<usize>) {
852-
Step::steps_between(&self.start, &self.end)
852+
if self.start < self.end {
853+
(0, Some(0));
854+
} else {
855+
Step::steps_between(&self.start, &self.end)
856+
}
853857
}
854858

855859
#[inline]

0 commit comments

Comments
 (0)
Please sign in to comment.