Closed
Description
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.
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Category: This is a bug.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessRelevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.