forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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 rust-lang#55632 - ollie27:deny_overflowing_literals, …
…r=Centril Deny the `overflowing_literals` lint for all editions The `overflowing_literals` was made deny by default for the 2018 edition by rust-lang#54507, however I'm not aware of any reason it can't be made deny by default for the 2015 edition as well.
- Loading branch information
Showing
12 changed files
with
56 additions
and
43 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
2 changes: 0 additions & 2 deletions
2
...edition-deny-overflowing-literals-2018.rs → ...test/ui/lint/deny-overflowing-literals.rs
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
// edition:2018 | ||
|
||
fn main() { | ||
let x: u8 = 256; | ||
//~^ error: literal out of range for u8 | ||
|
2 changes: 1 addition & 1 deletion
2
...ion-deny-overflowing-literals-2018.stderr → .../ui/lint/deny-overflowing-literals.stderr
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#![allow(dead_code)] | ||
#![warn(overflowing_literals)] | ||
|
||
// compile-flags: -D unused-comparisons | ||
fn main() { } | ||
|
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 |
---|---|---|
@@ -1,18 +1,22 @@ | ||
error: comparison is useless due to type limits | ||
--> $DIR/lint-type-limits2.rs:12:5 | ||
--> $DIR/lint-type-limits2.rs:13:5 | ||
| | ||
LL | 128 > bar() //~ ERROR comparison is useless due to type limits | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: requested on the command line with `-D unused-comparisons` | ||
|
||
warning: literal out of range for i8 | ||
--> $DIR/lint-type-limits2.rs:12:5 | ||
--> $DIR/lint-type-limits2.rs:13:5 | ||
| | ||
LL | 128 > bar() //~ ERROR comparison is useless due to type limits | ||
| ^^^ | ||
| | ||
= note: #[warn(overflowing_literals)] on by default | ||
note: lint level defined here | ||
--> $DIR/lint-type-limits2.rs:2:9 | ||
| | ||
LL | #![warn(overflowing_literals)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#![allow(dead_code)] | ||
#![warn(overflowing_literals)] | ||
|
||
// compile-flags: -D unused-comparisons | ||
fn main() { } | ||
|
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 |
---|---|---|
@@ -1,18 +1,22 @@ | ||
error: comparison is useless due to type limits | ||
--> $DIR/lint-type-limits3.rs:8:11 | ||
--> $DIR/lint-type-limits3.rs:9:11 | ||
| | ||
LL | while 200 != i { //~ ERROR comparison is useless due to type limits | ||
| ^^^^^^^^ | ||
| | ||
= note: requested on the command line with `-D unused-comparisons` | ||
|
||
warning: literal out of range for i8 | ||
--> $DIR/lint-type-limits3.rs:8:11 | ||
--> $DIR/lint-type-limits3.rs:9:11 | ||
| | ||
LL | while 200 != i { //~ ERROR comparison is useless due to type limits | ||
| ^^^ | ||
| | ||
= note: #[warn(overflowing_literals)] on by default | ||
note: lint level defined here | ||
--> $DIR/lint-type-limits3.rs:2:9 | ||
| | ||
LL | #![warn(overflowing_literals)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
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