We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96f3879 commit c25b82fCopy full SHA for c25b82f
src/libcore/iter/range.rs
@@ -646,7 +646,11 @@ impl<A: Step> Iterator for ops::RangeInclusive<A> {
646
}
647
let is_iterating = self.start < self.end;
648
Some(if is_iterating {
649
- let n = Step::forward(self.start.clone(), 1);
+ // SAFETY: just checked precondition
650
+ // We use the unchecked version here, because
651
+ // otherwise `for _ in '\0'..=char::MAX`
652
+ // does not successfully remove panicking code.
653
+ let n = unsafe { Step::forward_unchecked(self.start.clone(), 1) };
654
mem::replace(&mut self.start, n)
655
} else {
656
self.exhausted = true;
0 commit comments