From 23900770ab1aa516243371dbb4b5d7554dd31dbc Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Mon, 4 Nov 2019 15:34:19 -0500 Subject: [PATCH] Move to miri.rs and re-export it --- src/libpanic_unwind/lib.rs | 8 ++++---- src/libpanic_unwind/miri.rs | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/libpanic_unwind/lib.rs b/src/libpanic_unwind/lib.rs index 7c4e7bf1b17..f9b2edbe59d 100644 --- a/src/libpanic_unwind/lib.rs +++ b/src/libpanic_unwind/lib.rs @@ -39,6 +39,9 @@ cfg_if::cfg_if! { if #[cfg(miri)] { #[path = "miri.rs"] mod imp; + // Export this at the root of the crate so that Miri + // has a stable palce to look it up + pub use imp::miri_panic_trampoline; } else if #[cfg(target_os = "emscripten")] { #[path = "emcc.rs"] mod imp; @@ -98,7 +101,4 @@ pub unsafe extern "C" fn __rust_start_panic(payload: usize) -> u32 { imp::panic(Box::from_raw((*payload).box_me_up())) } -// A dummy helper function for Miri. -// Used to push an empty stack frame when we start unwinding -#[cfg(miri)] -pub fn miri_panic_trampoline() {} + diff --git a/src/libpanic_unwind/miri.rs b/src/libpanic_unwind/miri.rs index 254a9383b42..2b41d338ce2 100644 --- a/src/libpanic_unwind/miri.rs +++ b/src/libpanic_unwind/miri.rs @@ -21,3 +21,8 @@ pub unsafe fn cleanup(ptr: *mut u8) -> Box { fn rust_eh_personality() { unsafe { core::intrinsics::abort() } } + +// A dummy helper function for Miri. +// Used to push an empty stack frame when we start unwinding +#[cfg(miri)] +pub fn miri_panic_trampoline() {}