From 8936d67e7f7a6ab1318e6179ac3b839ffb47b430 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Tue, 19 Nov 2019 10:11:25 -0500 Subject: [PATCH] Delegate to the actual panic runtime crate --- src/shims/foreign_items.rs | 3 ++- src/shims/panic.rs | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs index 3a95ffd78e3..130c5d28fff 100644 --- a/src/shims/foreign_items.rs +++ b/src/shims/foreign_items.rs @@ -134,7 +134,8 @@ fn emulate_foreign_item( // that is, calls to `extern "Rust" { fn __rust_start_panic(...) }`. // We forward this to the underlying *implementation* in "libpanic_unwind". "__rust_start_panic" => { - let start_panic_instance = this.resolve_path(&["panic_unwind", "__rust_start_panic"])?; + let panic_runtime = tcx.crate_name(tcx.injected_panic_runtime().expect("No panic runtime found!")); + let start_panic_instance = this.resolve_path(&[&*panic_runtime.as_str(), "__rust_start_panic"])?; return Ok(Some(this.load_mir(start_panic_instance.def, None)?)); } // Similarly, we forward calls to the `panic_impl` foreign item to its implementation. diff --git a/src/shims/panic.rs b/src/shims/panic.rs index 9c5c3249191..ef9843056a0 100644 --- a/src/shims/panic.rs +++ b/src/shims/panic.rs @@ -47,13 +47,6 @@ fn handle_miri_start_panic( trace!("miri_start_panic: {:?}", this.frame().span); - if this.tcx.tcx.sess.panic_strategy() == PanicStrategy::Abort { - // FIXME: Add a better way of indicating 'abnormal' termination, - // since this is not really an 'unsupported' behavior - throw_unsup_format!("the evaluated program panicked"); - } - - // Get the raw pointer stored in arg[0] (the panic payload). let scalar = this.read_immediate(args[0])?; assert!(this.machine.panic_payload.is_none(), "the panic runtime should avoid double-panics"); this.machine.panic_payload = Some(scalar); -- 2.44.0