8
8
#![ doc( issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/" ) ]
9
9
#![ panic_runtime]
10
10
#![ allow( unused_features) ]
11
+ #![ feature( cfg_match) ]
11
12
#![ feature( core_intrinsics) ]
12
13
#![ feature( panic_runtime) ]
13
14
#![ feature( std_internals) ]
@@ -37,24 +38,26 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 {
37
38
38
39
abort ( ) ;
39
40
40
- cfg_if :: cfg_if ! {
41
- if # [ cfg( any( unix, target_os = "solid_asp3" ) ) ] {
41
+ cfg_match ! {
42
+ cfg( any( unix, target_os = "solid_asp3" ) ) => {
42
43
unsafe fn abort( ) -> ! {
43
44
libc:: abort( ) ;
44
45
}
45
- } else if #[ cfg( any( target_os = "hermit" ,
46
- all( target_vendor = "fortanix" , target_env = "sgx" ) ,
47
- target_os = "xous" ,
48
- target_os = "uefi" ,
49
- ) ) ] {
46
+ }
47
+ cfg( any( target_os = "hermit" ,
48
+ all( target_vendor = "fortanix" , target_env = "sgx" ) ,
49
+ target_os = "xous" ,
50
+ target_os = "uefi" ,
51
+ ) ) => {
50
52
unsafe fn abort( ) -> ! {
51
53
// call std::sys::abort_internal
52
54
extern "C" {
53
55
pub fn __rust_abort( ) -> !;
54
56
}
55
57
__rust_abort( ) ;
56
58
}
57
- } else if #[ cfg( all( windows, not( miri) ) ) ] {
59
+ }
60
+ cfg( all( windows, not( miri) ) ) => {
58
61
// On Windows, use the processor-specific __fastfail mechanism. In Windows 8
59
62
// and later, this will terminate the process immediately without running any
60
63
// in-process exception handlers. In earlier versions of Windows, this
@@ -68,20 +71,24 @@ pub unsafe fn __rust_start_panic(_payload: &mut dyn PanicPayload) -> u32 {
68
71
unsafe fn abort( ) -> ! {
69
72
#[ allow( unused) ]
70
73
const FAST_FAIL_FATAL_APP_EXIT : usize = 7 ;
71
- cfg_if :: cfg_if ! {
72
- if # [ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ] {
74
+ cfg_match ! {
75
+ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) => {
73
76
core:: arch:: asm!( "int $$0x29" , in( "ecx" ) FAST_FAIL_FATAL_APP_EXIT ) ;
74
- } else if #[ cfg( all( target_arch = "arm" , target_feature = "thumb-mode" ) ) ] {
77
+ }
78
+ cfg( all( target_arch = "arm" , target_feature = "thumb-mode" ) ) => {
75
79
core:: arch:: asm!( ".inst 0xDEFB" , in( "r0" ) FAST_FAIL_FATAL_APP_EXIT ) ;
76
- } else if #[ cfg( target_arch = "aarch64" ) ] {
80
+ }
81
+ cfg( target_arch = "aarch64" ) => {
77
82
core:: arch:: asm!( "brk 0xF003" , in( "x0" ) FAST_FAIL_FATAL_APP_EXIT ) ;
78
- } else {
83
+ }
84
+ _ => {
79
85
core:: intrinsics:: abort( ) ;
80
86
}
81
87
}
82
88
core:: intrinsics:: unreachable( ) ;
83
89
}
84
- } else {
90
+ }
91
+ _ => {
85
92
unsafe fn abort( ) -> ! {
86
93
core:: intrinsics:: abort( ) ;
87
94
}
0 commit comments