1
Fork 0
rust/src/test/ui/consts/control-flow/assert.rs
Aaron Hill 2779fc1c47
Emit a hard error when a panic occurs during const-eval
Previous, a panic during const evaluation would go through the
`const_err` lint. This PR ensures that such a panic always causes
compilation to fail.
2021-05-30 11:59:54 -05:00

14 lines
389 B
Rust

// Test that `assert` works when `const_panic` is enabled.
// revisions: stock const_panic
#![cfg_attr(const_panic, feature(const_panic))]
const _: () = assert!(true);
//[stock]~^ ERROR panicking in constants is unstable
const _: () = assert!(false);
//[stock]~^ ERROR panicking in constants is unstable
//[const_panic]~^^ ERROR any use of this value will cause an error
fn main() {}