1
Fork 0

Warn on all erroneous constants

This commit is contained in:
Oliver Schneider 2018-04-20 14:18:29 +02:00
parent 52ed3d8761
commit cd6c186e4e
No known key found for this signature in database
GPG key ID: A69F8D225B3AD7D9
18 changed files with 233 additions and 75 deletions

View file

@ -14,6 +14,7 @@ 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
//~| WARN this constant cannot be used
fn main() {
println!("{}", FOO);