Only warn on erroneous promoted constants

This commit is contained in:
Oliver Schneider
2018-04-08 22:26:28 +02:00
parent 602b3957f1
commit a406af885d
13 changed files with 129 additions and 30 deletions

View File

@@ -1,17 +1,14 @@
warning: attempt to subtract with overflow
--> $DIR/conditional_array_execution.rs:13:19
--> $DIR/conditional_array_execution.rs:15:19
|
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
| ^^^^^
|
= note: #[warn(const_err)] on by default
error[E0080]: constant evaluation error
--> $DIR/conditional_array_execution.rs:17:20
warning: constant evaluation error
--> $DIR/conditional_array_execution.rs:19:20
|
LL | println!("{}", FOO); //~ E0080
LL | println!("{}", FOO);
| ^^^ referenced constant has errors
error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.