File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ use unwind as uw;
57
57
#[ repr( C ) ]
58
58
struct Exception {
59
59
_uwe : uw:: _Unwind_Exception ,
60
- cause : Option < Box < dyn Any + Send > > ,
60
+ cause : Box < dyn Any + Send > ,
61
61
}
62
62
63
63
pub unsafe fn panic ( data : Box < dyn Any + Send > ) -> u32 {
@@ -67,7 +67,7 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
67
67
exception_cleanup,
68
68
private : [ 0 ; uw:: unwinder_private_data_size] ,
69
69
} ,
70
- cause : Some ( data) ,
70
+ cause : data,
71
71
} ) ;
72
72
let exception_param = Box :: into_raw ( exception) as * mut uw:: _Unwind_Exception ;
73
73
return uw:: _Unwind_RaiseException ( exception_param) as u32 ;
@@ -87,10 +87,8 @@ pub fn payload() -> *mut u8 {
87
87
}
88
88
89
89
pub unsafe fn cleanup ( ptr : * mut u8 ) -> Box < dyn Any + Send > {
90
- let my_ep = ptr as * mut Exception ;
91
- let cause = ( * my_ep) . cause . take ( ) ;
92
- uw:: _Unwind_DeleteException ( ptr as * mut _ ) ;
93
- cause. unwrap ( )
90
+ let exception = Box :: from_raw ( ptr as * mut Exception ) ;
91
+ exception. cause
94
92
}
95
93
96
94
// Rust's exception class identifier. This is used by personality routines to
You can’t perform that action at this time.
0 commit comments