-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #109554 - MU001999:master, r=WaffleLapkin
Suggest ..= when someone tries to create an overflowing range Fixes #109529
- Loading branch information
Showing
6 changed files
with
94 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// run-rustfix | ||
|
||
fn main() { | ||
for _ in 0..=255 as u8 {} //~ ERROR range endpoint is out of range | ||
for _ in 0..=(255 as u8) {} //~ ERROR range endpoint is out of range | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// run-rustfix | ||
|
||
fn main() { | ||
for _ in 0..256 as u8 {} //~ ERROR range endpoint is out of range | ||
for _ in 0..(256 as u8) {} //~ ERROR range endpoint is out of range | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error: range endpoint is out of range for `u8` | ||
--> $DIR/issue-109529.rs:4:14 | ||
| | ||
LL | for _ in 0..256 as u8 {} | ||
| ------^^^^^^ | ||
| | | ||
| help: use an inclusive range instead: `0..=255` | ||
| | ||
= note: `#[deny(overflowing_literals)]` on by default | ||
|
||
error: range endpoint is out of range for `u8` | ||
--> $DIR/issue-109529.rs:5:14 | ||
| | ||
LL | for _ in 0..(256 as u8) {} | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
help: use an inclusive range instead | ||
| | ||
LL | for _ in 0..=(255 as u8) {} | ||
| + ~~~ | ||
|
||
error: aborting due to 2 previous errors | ||
|