-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Errors in promoteds may only cause lints not hard errors
- Loading branch information
Showing
19 changed files
with
157 additions
and
176 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
2 changes: 1 addition & 1 deletion
2
...test/compile-fail/promoted_div_by_zero.rs → src/test/run-fail/promoted_div_by_zero.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
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,8 +1,10 @@ | ||
// build-fail | ||
// build-pass | ||
|
||
#![warn(const_err)] | ||
|
||
fn main() { | ||
&{[1, 2, 3][4]}; | ||
//~^ ERROR index out of bounds | ||
//~| ERROR reaching this expression at runtime will panic or abort | ||
//~| ERROR erroneous constant used [E0080] | ||
&{ [1, 2, 3][4] }; | ||
//~^ WARN index out of bounds | ||
//~| WARN reaching this expression at runtime will panic or abort | ||
//~| WARN erroneous constant used [const_err] | ||
} |
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,25 +1,26 @@ | ||
error: index out of bounds: the len is 3 but the index is 4 | ||
--> $DIR/array-literal-index-oob.rs:4:7 | ||
warning: index out of bounds: the len is 3 but the index is 4 | ||
--> $DIR/array-literal-index-oob.rs:6:8 | ||
| | ||
LL | &{[1, 2, 3][4]}; | ||
| ^^^^^^^^^^^^ | ||
LL | &{ [1, 2, 3][4] }; | ||
| ^^^^^^^^^^^^ | ||
| | ||
= note: `#[deny(const_err)]` on by default | ||
|
||
error: reaching this expression at runtime will panic or abort | ||
--> $DIR/array-literal-index-oob.rs:4:7 | ||
note: lint level defined here | ||
--> $DIR/array-literal-index-oob.rs:3:9 | ||
| | ||
LL | &{[1, 2, 3][4]}; | ||
| --^^^^^^^^^^^^- | ||
| | | ||
| indexing out of bounds: the len is 3 but the index is 4 | ||
LL | #![warn(const_err)] | ||
| ^^^^^^^^^ | ||
|
||
error[E0080]: erroneous constant used | ||
--> $DIR/array-literal-index-oob.rs:4:5 | ||
warning: reaching this expression at runtime will panic or abort | ||
--> $DIR/array-literal-index-oob.rs:6:8 | ||
| | ||
LL | &{[1, 2, 3][4]}; | ||
| ^^^^^^^^^^^^^^^ referenced constant has errors | ||
LL | &{ [1, 2, 3][4] }; | ||
| ---^^^^^^^^^^^^-- | ||
| | | ||
| indexing out of bounds: the len is 3 but the index is 4 | ||
|
||
error: aborting due to 3 previous errors | ||
warning: erroneous constant used | ||
--> $DIR/array-literal-index-oob.rs:6:5 | ||
| | ||
LL | &{ [1, 2, 3][4] }; | ||
| ^^^^^^^^^^^^^^^^^ referenced constant has errors | ||
|
||
For more information about this error, try `rustc --explain E0080`. |
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
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
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,22 +1,22 @@ | ||
// build-fail | ||
// build-pass | ||
// compile-flags: -O | ||
|
||
#![deny(const_err)] | ||
#![warn(const_err)] | ||
|
||
fn main() { | ||
println!("{}", 0u32 - 1); | ||
let _x = 0u32 - 1; | ||
//~^ ERROR const_err | ||
println!("{}", 1/(1-1)); | ||
//~^ ERROR attempt to divide by zero [const_err] | ||
//~| ERROR const_err | ||
//~| ERROR erroneous constant used [E0080] | ||
let _x = 1/(1-1); | ||
//~^ ERROR const_err | ||
println!("{}", 1/(false as u32)); | ||
//~^ ERROR attempt to divide by zero [const_err] | ||
//~| ERROR const_err | ||
//~| ERROR erroneous constant used [E0080] | ||
let _x = 1/(false as u32); | ||
//~^ ERROR const_err | ||
//~^ WARN const_err | ||
println!("{}", 1 / (1 - 1)); | ||
//~^ WARN attempt to divide by zero [const_err] | ||
//~| WARN const_err | ||
//~| WARN erroneous constant used [const_err] | ||
let _x = 1 / (1 - 1); | ||
//~^ WARN const_err | ||
println!("{}", 1 / (false as u32)); | ||
//~^ WARN attempt to divide by zero [const_err] | ||
//~| WARN const_err | ||
//~| WARN erroneous constant used [const_err] | ||
let _x = 1 / (false as u32); | ||
//~^ WARN const_err | ||
} |
Oops, something went wrong.