Skip to content

Commit b270e7f

Browse files
committed
Tighter size_hint lower bound for ranges larger than usize
1 parent c0b4440 commit b270e7f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/iter/range.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ impl<A: Step> Iterator for ops::Range<A> {
285285
// NOTE: the safety of `unsafe impl TrustedLen` depends on this being correct!
286286
match Step::steps_between(&self.start, &self.end) {
287287
Some(hint) => (hint, Some(hint)),
288-
None => (0, None)
288+
None => (usize::MAX, None)
289289
}
290290
}
291291

@@ -410,7 +410,7 @@ impl<A: Step> Iterator for ops::RangeInclusive<A> {
410410

411411
match Step::steps_between(&self.start, &self.end) {
412412
Some(hint) => (hint.saturating_add(1), hint.checked_add(1)),
413-
None => (0, None),
413+
None => (usize::MAX, None),
414414
}
415415
}
416416

0 commit comments

Comments
 (0)