@@ -16,7 +16,7 @@ use rustc_macros::{HashStable, TyDecodable, TyEncodable, extension};
1616use rustc_session:: config:: OptLevel ;
1717use rustc_span:: { DUMMY_SP , ErrorGuaranteed , Span , Symbol , sym} ;
1818use rustc_target:: callconv:: FnAbi ;
19- use rustc_target:: spec:: { HasTargetSpec , HasX86AbiOpt , PanicStrategy , Target , X86Abi } ;
19+ use rustc_target:: spec:: { HasTargetSpec , HasX86AbiOpt , Target , X86Abi } ;
2020use tracing:: debug;
2121use { rustc_abi as abi, rustc_hir as hir} ;
2222
@@ -1193,20 +1193,16 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: ExternAbi)
11931193 //
11941194 // Note that this is true regardless ABI specified on the function -- a `extern "C-unwind"`
11951195 // function defined in Rust is also required to abort.
1196- if matches ! ( tcx. sess. panic_strategy( ) , PanicStrategy :: Abort | PanicStrategy :: ImmediateAbort )
1197- && !tcx. is_foreign_item ( did)
1198- {
1196+ if !tcx. sess . panic_strategy ( ) . unwinds ( ) && !tcx. is_foreign_item ( did) {
11991197 return false ;
12001198 }
12011199
12021200 // With -Z panic-in-drop=abort, drop_in_place never unwinds.
12031201 //
12041202 // This is not part of `codegen_fn_attrs` as it can differ between crates
12051203 // and therefore cannot be computed in core.
1206- if matches ! (
1207- tcx. sess. opts. unstable_opts. panic_in_drop,
1208- PanicStrategy :: Abort | PanicStrategy :: ImmediateAbort
1209- ) && tcx. is_lang_item ( did, LangItem :: DropInPlace )
1204+ if !tcx. sess . opts . unstable_opts . panic_in_drop . unwinds ( )
1205+ && tcx. is_lang_item ( did, LangItem :: DropInPlace )
12101206 {
12111207 return false ;
12121208 }
@@ -1244,7 +1240,7 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: ExternAbi)
12441240 | RiscvInterruptS
12451241 | RustInvalid
12461242 | Unadjusted => false ,
1247- Rust | RustCall | RustCold => tcx. sess . panic_strategy ( ) == PanicStrategy :: Unwind ,
1243+ Rust | RustCall | RustCold => tcx. sess . panic_strategy ( ) . unwinds ( ) ,
12481244 }
12491245}
12501246
0 commit comments