Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
overflow_checks intrinsic compile time perf trial
  • Loading branch information
pitaj committed Oct 9, 2025
commit 47e50ab1635893b9e8d10ee1ce8fda51d7d12d5e
5 changes: 5 additions & 0 deletions library/core/src/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,11 @@ impl<A: Step> Iterator for ops::RangeFrom<A> {

#[inline]
fn next(&mut self) -> Option<A> {
// Panic when at max-2, rather than at max-1 as usual
if crate::intrinsics::overflow_checks() {
Step::forward(self.start.clone(), 2);
}

let n = Step::forward(self.start.clone(), 1);
Some(mem::replace(&mut self.start, n))
}
Expand Down
Loading