@@ -61,7 +61,7 @@ struct Exception {
6161pub unsafe fn panic ( data : Box < dyn Any + Send > ) -> u32 {
6262 let exception = Box :: new ( Exception {
6363 _uwe : uw:: _Unwind_Exception {
64- exception_class : rust_exception_class ( ) ,
64+ exception_class : RUST_EXCEPTION_CLASS ,
6565 exception_cleanup : Some ( exception_cleanup) ,
6666 private : [ core:: ptr:: null ( ) ; uw:: unwinder_private_data_size] ,
6767 } ,
@@ -84,7 +84,7 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
8484
8585pub unsafe fn cleanup ( ptr : * mut u8 ) -> Box < dyn Any + Send > {
8686 let exception = ptr as * mut uw:: _Unwind_Exception ;
87- if ( * exception) . exception_class != rust_exception_class ( ) {
87+ if ( * exception) . exception_class != RUST_EXCEPTION_CLASS {
8888 uw:: _Unwind_DeleteException ( exception) ;
8989 super :: __rust_foreign_exception ( ) ;
9090 }
@@ -107,7 +107,4 @@ pub unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> {
107107
108108// Rust's exception class identifier. This is used by personality routines to
109109// determine whether the exception was thrown by their own runtime.
110- fn rust_exception_class ( ) -> uw:: _Unwind_Exception_Class {
111- // M O Z \0 R U S T -- vendor, language
112- 0x4d4f5a_00_52555354
113- }
110+ const RUST_EXCEPTION_CLASS : uw:: _Unwind_Exception_Class = u64:: from_be_bytes ( * b"MOZ\0 RUST" ) ;
0 commit comments