2021-01-01 14:47:45 +01:00
|
|
|
// compile-flags: -Ztreat-err-as-bug=2
|
2022-03-08 15:05:50 +01:00
|
|
|
//~^ ERROR 1:1: 1:1: ty::ConstKind::Error constructed but no error reported
|
2020-08-19 12:05:32 +02:00
|
|
|
// build-fail
|
|
|
|
|
// failure-status: 101
|
2020-08-20 09:20:57 +02:00
|
|
|
// rustc-env:RUST_BACKTRACE=1
|
2020-08-19 12:05:32 +02:00
|
|
|
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
|
|
|
|
|
// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
|
|
|
|
|
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
|
|
|
|
|
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
|
|
|
|
|
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
|
|
|
|
|
// normalize-stderr-test "thread.*panicked.*\n" -> ""
|
|
|
|
|
// normalize-stderr-test "stack backtrace:\n" -> ""
|
2020-08-21 00:00:00 +00:00
|
|
|
// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
|
|
|
|
|
// normalize-stderr-test "\s at .*\n" -> ""
|
2020-08-19 12:05:32 +02:00
|
|
|
// normalize-stderr-test ".*note: Some details.*\n" -> ""
|
|
|
|
|
|
|
|
|
|
#![allow(unconditional_panic)]
|
|
|
|
|
|
2021-01-01 14:47:45 +01:00
|
|
|
#[warn(const_err)]
|
|
|
|
|
const X: i32 = 1 / 0; //~WARN any use of this value will cause an error
|
2021-01-30 14:49:22 +01:00
|
|
|
//~| WARN this was previously accepted by the compiler but is being phased out
|
2021-01-01 14:47:45 +01:00
|
|
|
|
2020-08-19 12:05:32 +02:00
|
|
|
fn main() {
|
2021-01-01 14:47:45 +01:00
|
|
|
let x: &'static i32 = &X;
|
2021-01-24 12:50:30 +01:00
|
|
|
//~^ ERROR evaluation of constant value failed
|
2020-08-19 12:05:32 +02:00
|
|
|
println!("x={}", x);
|
|
|
|
|
}
|