don't ICE when we unwind despite panic=abort

This commit is contained in:
Ralf Jung 2021-03-14 17:10:45 +01:00
parent c9ff02f549
commit 15465a5881
2 changed files with 14 additions and 1 deletions

View File

@ -45,7 +45,9 @@ fn handle_miri_start_panic(
trace!("miri_start_panic: {:?}", this.frame().instance);
// Make sure we only start unwinding when this matches our panic strategy.
assert_eq!(this.tcx.sess.panic_strategy(), PanicStrategy::Unwind);
if this.tcx.sess.panic_strategy() != PanicStrategy::Unwind {
throw_ub_format!("unwinding despite panic=abort");
}
// Get the raw pointer stored in arg[0] (the panic payload).
let &[ref payload] = check_arg_count(args)?;

View File

@ -0,0 +1,11 @@
// compile-flags: -Cpanic=abort
//! Unwinding despite `-C panic=abort` is an error.
extern "Rust" {
fn miri_start_panic(payload: *mut u8) -> !;
}
fn main() {
unsafe { miri_start_panic(&mut 0); } //~ ERROR unwinding despite panic=abort
}