]> git.lizzy.rs Git - rust.git/blobdiff - src/libpanic_unwind/lib.rs
Rollup merge of #67734 - XAMPPRocky:master, r=skade
[rust.git] / src / libpanic_unwind / lib.rs
index 3a14197c77bec3ba289315fc1cfb8773f58a6a2f..6383ae39fb6dba0c6795de05873964bc528341bb 100644 (file)
 
 #![no_std]
 #![unstable(feature = "panic_unwind", issue = "32837")]
-#![doc(html_root_url = "https://doc.rust-lang.org/nightly/",
-       issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
-
+#![doc(
+    html_root_url = "https://doc.rust-lang.org/nightly/",
+    issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/"
+)]
 #![feature(core_intrinsics)]
 #![feature(lang_items)]
 #![feature(libc)]
 #![feature(staged_api)]
 #![feature(std_internals)]
 #![feature(unwind_attributes)]
-
+#![feature(abi_thiscall)]
 #![panic_runtime]
 #![feature(panic_runtime)]
 
 use alloc::boxed::Box;
 use core::intrinsics;
 use core::mem;
-use core::raw;
 use core::panic::BoxMeUp;
+use core::raw;
 
 cfg_if::cfg_if! {
     if #[cfg(target_os = "emscripten")] {
     }
 }
 
+extern "C" {
+    /// Handler in libstd called when a panic object is dropped outside of
+    /// `catch_unwind`.
+    fn __rust_drop_panic() -> !;
+}
+
 mod dwarf;
 
 // Entry point for catching an exception, implemented using the `try` intrinsic
 // hairy and tightly coupled, for more information see the compiler's
 // implementation of this.
 #[no_mangle]
-pub unsafe extern "C" fn __rust_maybe_catch_panic(f: fn(*mut u8),
-                                                  data: *mut u8,
-                                                  data_ptr: *mut usize,
-                                                  vtable_ptr: *mut usize)
-                                                  -> u32 {
+pub unsafe extern "C" fn __rust_maybe_catch_panic(
+    f: fn(*mut u8),
+    data: *mut u8,
+    data_ptr: *mut usize,
+    vtable_ptr: *mut usize,
+) -> u32 {
     let mut payload = imp::payload();
     if intrinsics::r#try(f, data, &mut payload as *mut _ as *mut _) == 0 {
         0