1 #![allow(nonstandard_style)]
6 pub fn payload() -> *mut u8 {
10 pub unsafe fn panic(data: Box<dyn Any + Send>) -> ! {
11 core::intrinsics::miri_start_panic(Box::into_raw(data))
14 pub unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> {
18 // This is required by the compiler to exist (e.g., it's a lang item),
19 // but is never used by Miri. Therefore, we just use a stub here
20 #[lang = "eh_personality"]
22 fn rust_eh_personality() {
23 unsafe { core::intrinsics::abort() }
26 // The rest is required on *some* targets to exist (specifically, MSVC targets that use SEH).
27 // We just add it on all targets. Copied from `seh.rs`.
29 pub struct _TypeDescriptor {
30 pub pVFTable: *const u8,
36 #[link_name = "\x01??_7type_info@@6B@"]
37 static TYPE_INFO_VTABLE: *const u8;
40 const TYPE_NAME: [u8; 11] = *b"rust_panic\0";
42 #[cfg_attr(not(test), lang = "eh_catch_typeinfo")]
43 static mut TYPE_DESCRIPTOR: _TypeDescriptor = _TypeDescriptor {
44 pVFTable: unsafe { &TYPE_INFO_VTABLE } as *const _ as *const _,
45 spare: core::ptr::null_mut(),