File tree 3 files changed +20
-16
lines changed
3 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -2056,6 +2056,7 @@ dependencies = [
2056
2056
name = " panic_abort"
2057
2057
version = " 0.0.0"
2058
2058
dependencies = [
2059
+ " cfg-if" ,
2059
2060
" compiler_builtins" ,
2060
2061
" core" ,
2061
2062
" libc" ,
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ bench = false
11
11
doc = false
12
12
13
13
[dependencies ]
14
+ cfg-if = { version = " 0.1.8" , features = [' rustc-dep-of-std' ] }
14
15
core = { path = " ../libcore" }
15
16
libc = { version = " 0.2" , default-features = false }
16
17
compiler_builtins = " 0.1.0"
Original file line number Diff line number Diff line change @@ -40,23 +40,25 @@ pub unsafe extern "C" fn __rust_panic_cleanup(_: *mut u8) -> *mut (dyn Any + Sen
40
40
pub unsafe extern "C" fn __rust_start_panic ( _payload : usize ) -> u32 {
41
41
abort ( ) ;
42
42
43
- #[ cfg( any( unix, target_os = "cloudabi" ) ) ]
44
- unsafe fn abort ( ) -> ! {
45
- libc:: abort ( ) ;
46
- }
47
-
48
- #[ cfg( any( windows, all( target_arch = "wasm32" , not( target_os = "emscripten" ) ) ) ) ]
49
- unsafe fn abort ( ) -> ! {
50
- core:: intrinsics:: abort ( ) ;
51
- }
52
-
53
- #[ cfg( any( target_os = "hermit" , all( target_vendor = "fortanix" , target_env = "sgx" ) ) ) ]
54
- unsafe fn abort ( ) -> ! {
55
- // call std::sys::abort_internal
56
- extern "C" {
57
- pub fn __rust_abort ( ) -> !;
43
+ cfg_if:: cfg_if! {
44
+ if #[ cfg( any( unix, target_os = "cloudabi" ) ) ] {
45
+ unsafe fn abort( ) -> ! {
46
+ libc:: abort( ) ;
47
+ }
48
+ } else if #[ cfg( any( target_os = "hermit" ,
49
+ all( target_vendor = "fortanix" , target_env = "sgx" ) ) ) ] {
50
+ unsafe fn abort( ) -> ! {
51
+ // call std::sys::abort_internal
52
+ extern "C" {
53
+ pub fn __rust_abort( ) -> !;
54
+ }
55
+ __rust_abort( ) ;
56
+ }
57
+ } else {
58
+ unsafe fn abort( ) -> ! {
59
+ core:: intrinsics:: abort( ) ;
60
+ }
58
61
}
59
- __rust_abort ( ) ;
60
62
}
61
63
}
62
64
You can’t perform that action at this time.
0 commit comments