This unsound code compiles in the playground (on Rust nightly 2019-12-01):
#![feature(const_panic)]
struct PrintName;
impl PrintName {
const VOID: ! = panic!();
}
fn main() {
let _ = PrintName::VOID;
}
And runs into an illegal instruction:
Compiling playground v0.0.1 (/playground)
Finished dev [unoptimized + debuginfo] target(s) in 0.65s
Running `target/debug/playground`
timeout: the monitored command dumped core
/root/entrypoint.sh: line 8: 7 Illegal instruction timeout --signal=KILL ${timeout} "$@"
I expected this to fail to compile because panicking in constants should cause compilation errors.
This unsound code compiles in the playground (on Rust nightly 2019-12-01):
And runs into an illegal instruction:
I expected this to fail to compile because panicking in constants should cause compilation errors.