Referring to erroneous constants in promoteds must abort the build

This commit is contained in:
Oliver Schneider
2018-06-03 02:04:20 +02:00
parent 5c0d1355f2
commit 9cb47de813
14 changed files with 292 additions and 34 deletions

View File

@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-pass
#![warn(const_err)]
const X: u32 = 5;
@@ -20,4 +19,5 @@ const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
fn main() {
println!("{}", FOO);
//~^ WARN this expression will panic at runtime
//~| ERROR erroneous constant used
}