Auto merge of #114993 - RalfJung:panic-nounwind, r=fee1-dead
interpret/miri: call the panic_nounwind machinery the same way codegen does
This commit is contained in:
commit
5c6a7e71cd
66 changed files with 408 additions and 243 deletions
|
|
@ -291,8 +291,8 @@ fn check_terminator<'tcx>(
|
|||
| TerminatorKind::FalseUnwind { .. }
|
||||
| TerminatorKind::Goto { .. }
|
||||
| TerminatorKind::Return
|
||||
| TerminatorKind::Resume
|
||||
| TerminatorKind::Terminate
|
||||
| TerminatorKind::UnwindResume
|
||||
| TerminatorKind::UnwindTerminate
|
||||
| TerminatorKind::Unreachable => Ok(()),
|
||||
TerminatorKind::Drop { place, .. } => {
|
||||
if !is_ty_const_destruct(tcx, place.ty(&body.local_decls, tcx).ty, body) {
|
||||
|
|
|
|||
|
|
@ -971,9 +971,22 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> {
|
|||
ecx.assert_panic(msg, unwind)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn abort(_ecx: &mut MiriInterpCx<'mir, 'tcx>, msg: String) -> InterpResult<'tcx, !> {
|
||||
throw_machine_stop!(TerminationInfo::Abort(msg))
|
||||
fn panic_nounwind(ecx: &mut InterpCx<'mir, 'tcx, Self>, msg: &str) -> InterpResult<'tcx> {
|
||||
ecx.start_panic_nounwind(msg)
|
||||
}
|
||||
|
||||
fn unwind_terminate(ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
|
||||
// Call the lang item.
|
||||
let panic = ecx.tcx.lang_items().panic_cannot_unwind().unwrap();
|
||||
let panic = ty::Instance::mono(ecx.tcx.tcx, panic);
|
||||
ecx.call_function(
|
||||
panic,
|
||||
Abi::Rust,
|
||||
&[],
|
||||
None,
|
||||
StackPopCleanup::Goto { ret: None, unwind: mir::UnwindAction::Unreachable },
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
|
|
|||
|
|
@ -34,10 +34,20 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
if this.emulate_intrinsic(instance, args, dest, ret)? {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// All remaining supported intrinsics have a return place.
|
||||
let intrinsic_name = this.tcx.item_name(instance.def_id());
|
||||
let intrinsic_name = intrinsic_name.as_str();
|
||||
|
||||
// Handle intrinsics without return place.
|
||||
match intrinsic_name {
|
||||
"abort" => {
|
||||
throw_machine_stop!(TerminationInfo::Abort(
|
||||
"the program aborted execution".to_owned()
|
||||
))
|
||||
}
|
||||
_ => {},
|
||||
}
|
||||
|
||||
// All remaining supported intrinsics have a return place.
|
||||
let ret = match ret {
|
||||
None => throw_unsup_format!("unimplemented (diverging) intrinsic: `{intrinsic_name}`"),
|
||||
Some(p) => p,
|
||||
|
|
@ -393,7 +403,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
"breakpoint" => {
|
||||
let [] = check_arg_count(args)?;
|
||||
// normally this would raise a SIGTRAP, which aborts if no debugger is connected
|
||||
throw_machine_stop!(TerminationInfo::Abort(format!("Trace/breakpoint trap")))
|
||||
throw_machine_stop!(TerminationInfo::Abort(format!("trace/breakpoint trap")))
|
||||
}
|
||||
|
||||
name => throw_unsup_format!("unimplemented intrinsic: `{name}`"),
|
||||
|
|
|
|||
|
|
@ -188,6 +188,25 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
)
|
||||
}
|
||||
|
||||
/// Start a non-unwinding panic in the interpreter with the given message as payload.
|
||||
fn start_panic_nounwind(&mut self, msg: &str) -> InterpResult<'tcx> {
|
||||
let this = self.eval_context_mut();
|
||||
|
||||
// First arg: message.
|
||||
let msg = this.allocate_str(msg, MiriMemoryKind::Machine.into(), Mutability::Not)?;
|
||||
|
||||
// Call the lang item.
|
||||
let panic = this.tcx.lang_items().panic_nounwind().unwrap();
|
||||
let panic = ty::Instance::mono(this.tcx.tcx, panic);
|
||||
this.call_function(
|
||||
panic,
|
||||
Abi::Rust,
|
||||
&[msg.to_ref(this)],
|
||||
None,
|
||||
StackPopCleanup::Goto { ret: None, unwind: mir::UnwindAction::Unreachable },
|
||||
)
|
||||
}
|
||||
|
||||
fn assert_panic(
|
||||
&mut self,
|
||||
msg: &mir::AssertMessage<'tcx>,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
fn main() {
|
||||
unsafe {
|
||||
core::intrinsics::breakpoint() //~ ERROR: Trace/breakpoint trap
|
||||
core::intrinsics::breakpoint() //~ ERROR: trace/breakpoint trap
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: abnormal termination: Trace/breakpoint trap
|
||||
error: abnormal termination: trace/breakpoint trap
|
||||
--> $DIR/breakpoint.rs:LL:CC
|
||||
|
|
||||
LL | core::intrinsics::breakpoint()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Trace/breakpoint trap
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trace/breakpoint trap
|
||||
|
|
||||
= note: inside `main` at $DIR/breakpoint.rs:LL:CC
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,35 @@
|
|||
thread 'main' panicked at $DIR/exported_symbol_bad_unwind2.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
error: abnormal termination: panic in a function that cannot unwind
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
thread caused non-unwinding panic. aborting.
|
||||
error: abnormal termination: the program aborted execution
|
||||
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
|
|
||||
LL | ABORT();
|
||||
| ^ the program aborted execution
|
||||
|
|
||||
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::panicking::begin_panic_handler::{closure#0}], !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
|
||||
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_cannot_unwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
note: inside `nounwind`
|
||||
--> $DIR/exported_symbol_bad_unwind2.rs:LL:CC
|
||||
|
|
||||
LL | / extern "C-unwind" fn nounwind() {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | panic!();
|
||||
LL | | }
|
||||
| |_^ panic in a function that cannot unwind
|
||||
|
|
||||
= note: inside `nounwind` at $DIR/exported_symbol_bad_unwind2.rs:LL:CC
|
||||
| |_^
|
||||
note: inside `main`
|
||||
--> $DIR/exported_symbol_bad_unwind2.rs:LL:CC
|
||||
|
|
||||
LL | unsafe { nounwind() }
|
||||
| ^^^^^^^^^^
|
||||
| ^
|
||||
|
||||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,35 @@
|
|||
thread 'main' panicked at $DIR/exported_symbol_bad_unwind2.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
error: abnormal termination: panic in a function that cannot unwind
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
thread caused non-unwinding panic. aborting.
|
||||
error: abnormal termination: the program aborted execution
|
||||
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
|
|
||||
LL | ABORT();
|
||||
| ^ the program aborted execution
|
||||
|
|
||||
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::panicking::begin_panic_handler::{closure#0}], !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
|
||||
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_cannot_unwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
note: inside `nounwind`
|
||||
--> $DIR/exported_symbol_bad_unwind2.rs:LL:CC
|
||||
|
|
||||
LL | / extern "C-unwind" fn nounwind() {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | panic!();
|
||||
LL | | }
|
||||
| |_^ panic in a function that cannot unwind
|
||||
|
|
||||
= note: inside `nounwind` at $DIR/exported_symbol_bad_unwind2.rs:LL:CC
|
||||
| |_^
|
||||
note: inside `main`
|
||||
--> $DIR/exported_symbol_bad_unwind2.rs:LL:CC
|
||||
|
|
||||
LL | unsafe { nounwind() }
|
||||
| ^^^^^^^^^^
|
||||
| ^
|
||||
|
||||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ error: Undefined Behavior: unwinding past a stack frame that does not allow unwi
|
|||
--> $DIR/exported_symbol_bad_unwind2.rs:LL:CC
|
||||
|
|
||||
LL | unsafe { nounwind() }
|
||||
| ^^^^^^^^^^ unwinding past a stack frame that does not allow unwinding
|
||||
| ^ unwinding past a stack frame that does not allow unwinding
|
||||
|
|
||||
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
|
||||
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
//@revisions: extern_block definition both
|
||||
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
|
||||
//@normalize-stderr-test: "\| +\^+" -> "| ^"
|
||||
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> "$1"
|
||||
//@normalize-stderr-test: "\n at [^\n]+" -> "$1"
|
||||
//@[definition,both]error-in-other-file: aborted execution
|
||||
#![feature(rustc_attrs, c_unwind)]
|
||||
|
||||
#[cfg_attr(any(definition, both), rustc_nounwind)]
|
||||
#[no_mangle]
|
||||
extern "C-unwind" fn nounwind() {
|
||||
//~[definition]^ ERROR: abnormal termination: panic in a function that cannot unwind
|
||||
//~[both]^^ ERROR: abnormal termination: panic in a function that cannot unwind
|
||||
panic!();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
|
||||
//@normalize-stderr-test: "\| +\^+" -> "| ^"
|
||||
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> "$1"
|
||||
//@normalize-stderr-test: "\n at [^\n]+" -> "$1"
|
||||
//@error-in-other-file: aborted execution
|
||||
#![feature(never_type)]
|
||||
|
||||
#[allow(deprecated, invalid_value)]
|
||||
fn main() {
|
||||
let _ = unsafe { std::mem::uninitialized::<!>() };
|
||||
//~^ ERROR: attempted to instantiate uninhabited type `!`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,24 @@
|
|||
error: abnormal termination: aborted execution: attempted to instantiate uninhabited type `!`
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
aborted execution: attempted to instantiate uninhabited type `!`
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
thread caused non-unwinding panic. aborting.
|
||||
error: abnormal termination: the program aborted execution
|
||||
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
|
|
||||
LL | ABORT();
|
||||
| ^ the program aborted execution
|
||||
|
|
||||
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::panicking::begin_panic_handler::{closure#0}], !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
|
||||
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
note: inside `main`
|
||||
--> $DIR/uninit_uninhabited_type.rs:LL:CC
|
||||
|
|
||||
LL | let _ = unsafe { std::mem::uninitialized::<!>() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to instantiate uninhabited type `!`
|
||||
|
|
||||
= note: inside `main` at $DIR/uninit_uninhabited_type.rs:LL:CC
|
||||
| ^
|
||||
|
||||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
|
||||
//@normalize-stderr-test: "\| +\^+" -> "| ^"
|
||||
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> "$1"
|
||||
//@normalize-stderr-test: "\n at [^\n]+" -> "$1"
|
||||
//@error-in-other-file: aborted execution
|
||||
|
||||
#[allow(deprecated, invalid_value)]
|
||||
fn main() {
|
||||
let _ = unsafe { std::mem::zeroed::<fn()>() };
|
||||
//~^ ERROR: attempted to zero-initialize type `fn()`, which is invalid
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,24 @@
|
|||
error: abnormal termination: aborted execution: attempted to zero-initialize type `fn()`, which is invalid
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
aborted execution: attempted to zero-initialize type `fn()`, which is invalid
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
thread caused non-unwinding panic. aborting.
|
||||
error: abnormal termination: the program aborted execution
|
||||
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
|
|
||||
LL | ABORT();
|
||||
| ^ the program aborted execution
|
||||
|
|
||||
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::panicking::begin_panic_handler::{closure#0}], !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
|
||||
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
note: inside `main`
|
||||
--> $DIR/zero_fn_ptr.rs:LL:CC
|
||||
|
|
||||
LL | let _ = unsafe { std::mem::zeroed::<fn()>() };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ aborted execution: attempted to zero-initialize type `fn()`, which is invalid
|
||||
|
|
||||
= note: inside `main` at $DIR/zero_fn_ptr.rs:LL:CC
|
||||
| ^
|
||||
|
||||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
|
||||
//@normalize-stderr-test: "\| +\^+" -> "| ^"
|
||||
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> "$1"
|
||||
//@normalize-stderr-test: "\n at [^\n]+" -> "$1"
|
||||
//@error-in-other-file: aborted execution
|
||||
|
||||
struct Foo;
|
||||
impl Drop for Foo {
|
||||
|
|
@ -9,7 +11,6 @@ impl Drop for Foo {
|
|||
}
|
||||
}
|
||||
fn main() {
|
||||
//~^ERROR: panic in a function that cannot unwind
|
||||
let _foo = Foo;
|
||||
panic!("first");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,17 +4,31 @@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
|||
thread 'main' panicked at $DIR/double_panic.rs:LL:CC:
|
||||
second
|
||||
stack backtrace:
|
||||
error: abnormal termination: panic in a function that cannot unwind
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
thread caused non-unwinding panic. aborting.
|
||||
error: abnormal termination: the program aborted execution
|
||||
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
|
|
||||
LL | ABORT();
|
||||
| ^ the program aborted execution
|
||||
|
|
||||
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::panicking::begin_panic_handler::{closure#0}], !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
|
||||
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_cannot_unwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
note: inside `main`
|
||||
--> $DIR/double_panic.rs:LL:CC
|
||||
|
|
||||
LL | / fn main() {
|
||||
LL | |
|
||||
LL | | let _foo = Foo;
|
||||
LL | | panic!("first");
|
||||
LL | | }
|
||||
| |_^ panic in a function that cannot unwind
|
||||
|
|
||||
= note: inside `main` at $DIR/double_panic.rs:LL:CC
|
||||
| |_^
|
||||
|
||||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
//@compile-flags: -Zmir-opt-level=3 -Zinline-mir-hint-threshold=1000
|
||||
// Enable MIR inlining to ensure that `TerminatorKind::Terminate` is generated
|
||||
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
|
||||
//@normalize-stderr-test: "\| +\^+" -> "| ^"
|
||||
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> "$1"
|
||||
//@normalize-stderr-test: "\n at [^\n]+" -> "$1"
|
||||
//@error-in-other-file: aborted execution
|
||||
// Enable MIR inlining to ensure that `TerminatorKind::UnwindTerminate` is generated
|
||||
// instead of just `UnwindAction::Terminate`.
|
||||
|
||||
#![feature(c_unwind)]
|
||||
|
|
@ -12,7 +17,6 @@ impl Drop for Foo {
|
|||
|
||||
#[inline(always)]
|
||||
fn has_cleanup() {
|
||||
//~^ ERROR: panic in a function that cannot unwind
|
||||
let _f = Foo;
|
||||
panic!();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,27 +3,41 @@ warning: You have explicitly enabled MIR optimizations, overriding Miri's defaul
|
|||
thread 'main' panicked at $DIR/terminate-terminator.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
error: abnormal termination: panic in a function that cannot unwind
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
thread caused non-unwinding panic. aborting.
|
||||
error: abnormal termination: the program aborted execution
|
||||
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
|
|
||||
LL | ABORT();
|
||||
| ^ the program aborted execution
|
||||
|
|
||||
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::panicking::begin_panic_handler::{closure#0}], !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
|
||||
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_cannot_unwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
note: inside `has_cleanup`
|
||||
--> $DIR/terminate-terminator.rs:LL:CC
|
||||
|
|
||||
LL | / fn has_cleanup() {
|
||||
LL | |
|
||||
LL | | let _f = Foo;
|
||||
LL | | panic!();
|
||||
LL | | }
|
||||
| |_^ panic in a function that cannot unwind
|
||||
|
|
||||
= note: inside `has_cleanup` at $DIR/terminate-terminator.rs:LL:CC
|
||||
| |_^
|
||||
note: inside `panic_abort`
|
||||
--> $DIR/terminate-terminator.rs:LL:CC
|
||||
|
|
||||
LL | has_cleanup();
|
||||
| ^^^^^^^^^^^^^
|
||||
| ^
|
||||
note: inside `main`
|
||||
--> $DIR/terminate-terminator.rs:LL:CC
|
||||
|
|
||||
LL | panic_abort();
|
||||
| ^^^^^^^^^^^^^
|
||||
| ^
|
||||
|
||||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
//@error-in-other-file: aborted execution
|
||||
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
|
||||
//@normalize-stderr-test: "\| +\^+" -> "| ^"
|
||||
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> "$1"
|
||||
//@normalize-stderr-test: "\n at [^\n]+" -> "$1"
|
||||
#![feature(c_unwind)]
|
||||
|
||||
extern "C" fn panic_abort() {
|
||||
//~^ ERROR: panic in a function that cannot unwind
|
||||
panic!()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,21 +1,35 @@
|
|||
thread 'main' panicked at $DIR/unwind-action-terminate.rs:LL:CC:
|
||||
explicit panic
|
||||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
|
||||
error: abnormal termination: panic in a function that cannot unwind
|
||||
thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC:
|
||||
panic in a function that cannot unwind
|
||||
stack backtrace:
|
||||
thread caused non-unwinding panic. aborting.
|
||||
error: abnormal termination: the program aborted execution
|
||||
--> RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
|
|
||||
LL | ABORT();
|
||||
| ^ the program aborted execution
|
||||
|
|
||||
= note: inside `std::sys::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/PLATFORM/mod.rs:LL:CC
|
||||
= note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::panicking::begin_panic_handler::{closure#0}], !>` at RUSTLIB/std/src/sys_common/backtrace.rs:LL:CC
|
||||
= note: inside `std::panicking::begin_panic_handler` at RUSTLIB/std/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_nounwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
= note: inside `core::panicking::panic_cannot_unwind` at RUSTLIB/core/src/panicking.rs:LL:CC
|
||||
note: inside `panic_abort`
|
||||
--> $DIR/unwind-action-terminate.rs:LL:CC
|
||||
|
|
||||
LL | / extern "C" fn panic_abort() {
|
||||
LL | |
|
||||
LL | | panic!()
|
||||
LL | | }
|
||||
| |_^ panic in a function that cannot unwind
|
||||
|
|
||||
= note: inside `panic_abort` at $DIR/unwind-action-terminate.rs:LL:CC
|
||||
| |_^
|
||||
note: inside `main`
|
||||
--> $DIR/unwind-action-terminate.rs:LL:CC
|
||||
|
|
||||
LL | panic_abort();
|
||||
| ^^^^^^^^^^^^^
|
||||
| ^
|
||||
|
||||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
||||
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ pub enum TerminatorKind {
|
|||
///
|
||||
/// Only permitted in cleanup blocks. `Resume` is not permitted with `-C unwind=abort` after
|
||||
/// deaggregation runs.
|
||||
Resume,
|
||||
UnwindResume,
|
||||
|
||||
/// Indicates that the landing pad is finished and that the process should abort.
|
||||
///
|
||||
|
|
@ -1057,7 +1057,7 @@ impl MirBody {
|
|||
TerminatorKind::FalseEdge { .. }
|
||||
| TerminatorKind::FalseUnwind { .. }
|
||||
| TerminatorKind::Goto { .. }
|
||||
| TerminatorKind::Resume
|
||||
| TerminatorKind::UnwindResume
|
||||
| TerminatorKind::GeneratorDrop
|
||||
| TerminatorKind::Abort
|
||||
| TerminatorKind::Return
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ fn moved_out_of_ref(db: &dyn HirDatabase, body: &MirBody) -> Vec<MovedOutOfRef>
|
|||
TerminatorKind::FalseEdge { .. }
|
||||
| TerminatorKind::FalseUnwind { .. }
|
||||
| TerminatorKind::Goto { .. }
|
||||
| TerminatorKind::Resume
|
||||
| TerminatorKind::UnwindResume
|
||||
| TerminatorKind::GeneratorDrop
|
||||
| TerminatorKind::Abort
|
||||
| TerminatorKind::Return
|
||||
|
|
@ -280,7 +280,7 @@ fn ever_initialized_map(
|
|||
let targets = match &terminator.kind {
|
||||
TerminatorKind::Goto { target } => vec![*target],
|
||||
TerminatorKind::SwitchInt { targets, .. } => targets.all_targets().to_vec(),
|
||||
TerminatorKind::Resume
|
||||
TerminatorKind::UnwindResume
|
||||
| TerminatorKind::Abort
|
||||
| TerminatorKind::Return
|
||||
| TerminatorKind::Unreachable => vec![],
|
||||
|
|
@ -371,7 +371,7 @@ fn mutability_of_locals(
|
|||
};
|
||||
match &terminator.kind {
|
||||
TerminatorKind::Goto { .. }
|
||||
| TerminatorKind::Resume
|
||||
| TerminatorKind::UnwindResume
|
||||
| TerminatorKind::Abort
|
||||
| TerminatorKind::Return
|
||||
| TerminatorKind::Unreachable
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ impl Filler<'_> {
|
|||
self.fill_operand(discr)?;
|
||||
}
|
||||
TerminatorKind::Goto { .. }
|
||||
| TerminatorKind::Resume
|
||||
| TerminatorKind::UnwindResume
|
||||
| TerminatorKind::Abort
|
||||
| TerminatorKind::Return
|
||||
| TerminatorKind::Unreachable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue