refactor RangeFromIter overflow-checks impl#154191
Open
pitaj wants to merge 1 commit intorust-lang:mainfrom
Open
refactor RangeFromIter overflow-checks impl#154191pitaj wants to merge 1 commit intorust-lang:mainfrom
pitaj wants to merge 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
|
tgross35
reviewed
Mar 22, 2026
Comment on lines
+27
to
+40
|
|
||
| // let a_next_ocno = next_ocno(&mut a.clone()); | ||
| // let a_next_ocyes = next_ocyes(&mut a); | ||
| // let b_next_ocyes = next_ocyes(&mut b.clone()); | ||
| // let b_next_ocno = next_ocno(&mut b); | ||
|
|
||
| // assert_eq!(n, a_next_ocno); | ||
| // assert_eq!(a_next_ocno, a_next_ocyes); | ||
| // assert_eq!(n, b_next_ocyes); | ||
| // assert_eq!(b_next_ocyes, b_next_ocno); | ||
|
|
||
|
|
||
| // assert_eq!(next_ocno(&mut a.clone()), next_ocyes(&mut a)); | ||
| // assert_eq!(next_ocyes(&mut b.clone()), next_ocno(&mut b)); |
Contributor
Author
There was a problem hiding this comment.
Knew I was going to forget about this 🤦♂️
Comment on lines
+43
to
+50
| // `b` should have wrapped | ||
| assert_eq!(0, next_ocyes(&mut b.clone())); | ||
| assert_eq!(0, next_ocno(&mut b)); | ||
| // `a` should be exhausted, | ||
| // which will wrap when called without overflow-checks | ||
| assert_eq!(0, next_ocno(&mut a.clone())); | ||
| // and panic when called with overflow-checks | ||
| let r = std::panic::catch_unwind(move || { |
Contributor
There was a problem hiding this comment.
(optional nit) Maybe give a and b names like next_with_oc and next_without_oc? It's a bit tricky to follow
Contributor
|
Checking what I said in #154191 (comment) @bors try jobs=x86_64-gnu-nopt Cc issue author @theemathas |
Contributor
|
⌛ Trying commit e173b53 with merge e81a45d… To cancel the try build, run the command Workflow: https://github.com/rust-lang/rust/actions/runs/23408886027 |
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 22, 2026
refactor RangeFromIter overflow-checks impl try-job: x86_64-gnu-nopt
Contributor
|
@bors try cancel |
Contributor
|
Try build cancelled. Cancelled workflows: |
tgross35
approved these changes
Mar 22, 2026
Crates with different overflow-checks settings accessing the same RangeFromIter resulted in incorrect values being yielded
Contributor
|
@bors r+ |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Crates with different overflow-checks settings accessing the same RangeFromIter resulted in incorrect values being yielded
Fixes #154124
r? @tgross35