Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5270: Change int/uint range_rev to use (hi,lo] instead of [hi,lo). #7524

Conversation

pnkfelix
Copy link
Member

@pnkfelix pnkfelix commented Jul 1, 2013

r? anyone.

Changes int/uint range_rev to iterate over range (hi,lo] instead of [hi,lo).

Fix #5270.

Also:

  • Adds unit tests for int/uint range functions
  • Updates the uses of range_rev to account for the new semantics. (Note that pretty much all of the updates there were strict improvements to the code in question; yay!)
  • Exposes new function, range_step_inclusive, which does the range [hi,lo], (at least when hi-lo is a multiple of the step parameter).
  • Special-cases when |step| == 1 removing unnecessary bounds-check. (I did not check whether LLVM was already performing this optimization; I figure it would be a net win to not leave that analysis to the compiler. If reviewer objects, I can easily remove that from the refactored code.)

pnkfelix added 2 commits July 1, 2013 12:32
… semantics.

Also added unit tests of range code to test refactoring.  The
num-range-rev.rs test will need to be updated when the range_rev
semantics change.
@pnkfelix
Copy link
Member Author

pnkfelix commented Jul 9, 2013

Oh, duh. I thought these commits had included fixes to the test code embedded in e.g. int_macros.rs, but it looks like they do not. No wonder all my bors attempts were failing! Sorry for the many misfires, everyone. Will fix soon.

@pnkfelix
Copy link
Member Author

closing in favor of rebased version in #7684.

@pnkfelix pnkfelix closed this Jul 10, 2013
bors added a commit that referenced this pull request Jul 16, 2013
…ss-issue5270-2ndpr, r=cmr

Changes int/uint range_rev to iterate over range `(hi,lo]` instead of `[hi,lo)`.

Fix #5270.

Also:
* Adds unit tests for int/uint range functions
* Updates the uses of `range_rev` to account for the new semantics.  (Note that pretty much all of the updates there were strict improvements to the code in question; yay!)
* Exposes new function, `range_step_inclusive`, which does the range `[hi,lo]`, (at least when `hi-lo` is a multiple of the `step` parameter).
* Special-cases when `|step| == 1` removing unnecessary bounds-check.  (I did not check whether LLVM was already performing this optimization; I figure it would be a net win to not leave that analysis to the compiler.  If reviewer objects, I can easily remove that from the refactored code.)

(This pull request is a rebased version of PR #7524, which went stale due to recent unrelated changes to num libraries.)
flip1995 pushed a commit to flip1995/rust that referenced this pull request Aug 12, 2021
…r=xFrednet

fix bug on mutable ref

fixes: rust-lang#7524

This PR is related to issue rust-lang#7524
changelog:  [`extend_with_drain`] Improve code suggestion for mutable and immutable references
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change range_rev to be inclusive on the low end
3 participants