don't ICE when we unwind despite panic=abort
This commit is contained in:
parent
c9ff02f549
commit
15465a5881
@ -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)?;
|
||||
|
11
tests/compile-fail/panic/unwind_panic_abort.rs
Normal file
11
tests/compile-fail/panic/unwind_panic_abort.rs
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user