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

libcore: fix overflow/underflow in range_step #5769

Closed
wants to merge 1 commit into from
Closed

libcore: fix overflow/underflow in range_step #5769

wants to merge 1 commit into from

Conversation

gifnksm
Copy link
Contributor

@gifnksm gifnksm commented Apr 7, 2013

uint::range_step or int::range_step causes overflow or underflow as following.
code:

fn main() {
    for uint::range_step(3, 0, -2) |n| {
        println(fmt!("%u", n));
    }
}

output:

3
1
18446744073709551615
18446744073709551613
...

This commit fixes this behavior as follows.

3
1

bors added a commit that referenced this pull request Apr 9, 2013
`uint::range_step` or `int::range_step` causes overflow or underflow as following.
code:
```rust
fn main() {
    for uint::range_step(3, 0, -2) |n| {
        println(fmt!("%u", n));
    }
}
```
output:
```
3
1
18446744073709551615
18446744073709551613
...
```
This commit fixes this behavior as follows.
```
3
1
```
@bors bors closed this Apr 9, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 14, 2020
…=phansch

new lint: match_like_matches_macro

Suggests using the `matches!` macro from `std` where appropriate.

`redundant_pattern_matching` has been moved into the `matches` pass to allow suppressing the suggestion where `is_some` and friends are a better replacement.

changelog: new lint: `match_like_matches_macro`
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.

2 participants