+// Destructor used if the C++ code decides to capture the exception and drop it
+// without propagating it. The catch part of the try intrinsic will set the
+// first word of the exception object to 0 so that it is skipped by the
+// destructor.
+//
+// Note that x86 Windows uses the "thiscall" calling convention for C++ member
+// functions instead of the default "C" calling convention.
+cfg_if::cfg_if! {
+ if #[cfg(target_arch = "x86")] {
+ unsafe extern "thiscall" fn exception_cleanup(e: *mut [u64; 2]) {
+ if (*e)[0] != 0 {
+ cleanup(*e);
+ }
+ }
+ unsafe extern "thiscall" fn exception_copy(_dest: *mut [u64; 2],
+ _src: *mut [u64; 2])
+ -> *mut [u64; 2] {
+ panic!("Rust panics cannot be copied");
+ }
+ } else {
+ unsafe extern "C" fn exception_cleanup(e: *mut [u64; 2]) {
+ if (*e)[0] != 0 {
+ cleanup(*e);
+ }
+ }
+ unsafe extern "C" fn exception_copy(_dest: *mut [u64; 2],
+ _src: *mut [u64; 2])
+ -> *mut [u64; 2] {
+ panic!("Rust panics cannot be copied");
+ }
+ }
+}
+