]> git.lizzy.rs Git - rust.git/blobdiff - src/libpanic_unwind/emcc.rs
Rollup merge of #68120 - Centril:ban-range-to-dotdotdot, r=oli-obk
[rust.git] / src / libpanic_unwind / emcc.rs
index 3d0d5a4151eed925b1716bf0e8a9a22b86f559a1..9d3fe5254f8a9de7b254d930bd133f031097dedb 100644 (file)
@@ -8,10 +8,10 @@
 
 #![allow(private_no_mangle_fns)]
 
+use alloc::boxed::Box;
 use core::any::Any;
-use core::ptr;
 use core::mem;
-use alloc::boxed::Box;
+use core::ptr;
 use libc::{self, c_int};
 use unwind as uw;
 
@@ -63,7 +63,7 @@ pub unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> {
 pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
     let sz = mem::size_of_val(&data);
     let exception = __cxa_allocate_exception(sz);
-    if exception == ptr::null_mut() {
+    if exception.is_null() {
         return uw::_URC_FATAL_PHASE1_ERROR as u32;
     }
     ptr::write(exception as *mut _, data);
@@ -72,12 +72,13 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
 
 #[lang = "eh_personality"]
 #[no_mangle]
-unsafe extern "C" fn rust_eh_personality(version: c_int,
-                                         actions: uw::_Unwind_Action,
-                                         exception_class: uw::_Unwind_Exception_Class,
-                                         exception_object: *mut uw::_Unwind_Exception,
-                                         context: *mut uw::_Unwind_Context)
-                                         -> uw::_Unwind_Reason_Code {
+unsafe extern "C" fn rust_eh_personality(
+    version: c_int,
+    actions: uw::_Unwind_Action,
+    exception_class: uw::_Unwind_Exception_Class,
+    exception_object: *mut uw::_Unwind_Exception,
+    context: *mut uw::_Unwind_Context,
+) -> uw::_Unwind_Reason_Code {
     __gxx_personality_v0(version, actions, exception_class, exception_object, context)
 }
 
@@ -85,13 +86,16 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
     fn __cxa_allocate_exception(thrown_size: libc::size_t) -> *mut libc::c_void;
     fn __cxa_begin_catch(thrown_exception: *mut libc::c_void) -> *mut libc::c_void;
     fn __cxa_end_catch();
-    fn __cxa_throw(thrown_exception: *mut libc::c_void,
-                   tinfo: *const TypeInfo,
-                   dest: *mut libc::c_void) -> !;
-    fn __gxx_personality_v0(version: c_int,
-                            actions: uw::_Unwind_Action,
-                            exception_class: uw::_Unwind_Exception_Class,
-                            exception_object: *mut uw::_Unwind_Exception,
-                            context: *mut uw::_Unwind_Context)
-                            -> uw::_Unwind_Reason_Code;
+    fn __cxa_throw(
+        thrown_exception: *mut libc::c_void,
+        tinfo: *const TypeInfo,
+        dest: *mut libc::c_void,
+    ) -> !;
+    fn __gxx_personality_v0(
+        version: c_int,
+        actions: uw::_Unwind_Action,
+        exception_class: uw::_Unwind_Exception_Class,
+        exception_object: *mut uw::_Unwind_Exception,
+        context: *mut uw::_Unwind_Context,
+    ) -> uw::_Unwind_Reason_Code;
 }