1515#![ unstable( feature = "panic_unwind" , issue = "32837" ) ]
1616#![ doc( issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/" ) ]
1717#![ feature( cfg_emscripten_wasm_eh) ]
18+ #![ feature( cfg_select) ]
1819#![ feature( core_intrinsics) ]
1920#![ feature( lang_items) ]
2021#![ feature( panic_unwind) ]
@@ -33,38 +34,44 @@ use alloc::boxed::Box;
3334use core:: any:: Any ;
3435use core:: panic:: PanicPayload ;
3536
36- cfg_if :: cfg_if ! {
37- if # [ cfg ( all( target_os = "emscripten" , not( emscripten_wasm_eh) ) ) ] {
37+ cfg_select ! {
38+ all( target_os = "emscripten" , not( emscripten_wasm_eh) ) => {
3839 #[ path = "emcc.rs" ]
3940 mod imp;
40- } else if #[ cfg( target_os = "hermit" ) ] {
41+ }
42+ target_os = "hermit" => {
4143 #[ path = "hermit.rs" ]
4244 mod imp;
43- } else if #[ cfg( target_os = "l4re" ) ] {
45+ }
46+ target_os = "l4re" => {
4447 // L4Re is unix family but does not yet support unwinding.
4548 #[ path = "dummy.rs" ]
4649 mod imp;
47- } else if #[ cfg( any(
50+ }
51+ any(
4852 all( target_family = "windows" , target_env = "gnu" ) ,
4953 target_os = "psp" ,
5054 target_os = "xous" ,
5155 target_os = "solid_asp3" ,
5256 all( target_family = "unix" , not( any( target_os = "espidf" , target_os = "nuttx" ) ) ) ,
5357 all( target_vendor = "fortanix" , target_env = "sgx" ) ,
5458 target_family = "wasm" ,
55- ) ) ] {
59+ ) => {
5660 #[ path = "gcc.rs" ]
5761 mod imp;
58- } else if #[ cfg( miri) ] {
62+ }
63+ miri => {
5964 // Use the Miri runtime on Windows as miri doesn't support funclet based unwinding,
6065 // only landingpad based unwinding. Also use the Miri runtime on unsupported platforms.
6166 #[ path = "miri.rs" ]
6267 mod imp;
63- } else if #[ cfg( all( target_env = "msvc" , not( target_arch = "arm" ) ) ) ] {
68+ }
69+ all( target_env = "msvc" , not( target_arch = "arm" ) ) => {
6470 // LLVM does not support unwinding on 32 bit ARM msvc (thumbv7a-pc-windows-msvc)
6571 #[ path = "seh.rs" ]
6672 mod imp;
67- } else {
73+ }
74+ _ => {
6875 // Targets that don't support unwinding.
6976 // - os=none ("bare metal" targets)
7077 // - os=uefi
0 commit comments