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

@@ -8,11 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-pass
const X: u32 = 5;
const Y: u32 = 6;
const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
//~^ WARN attempt to subtract with overflow
fn main() {
println!("{}", FOO); //~ E0080
println!("{}", FOO);
//~^ WARN constant evaluation error
}