@@ -11,11 +11,9 @@ use rustc::middle::region;
1111use rustc:: mir:: * ;
1212use rustc:: ty:: { self , Ty , TyCtxt } ;
1313use rustc:: util:: nodemap:: HirIdMap ;
14- use rustc_target:: spec:: PanicStrategy ;
1514use rustc_data_structures:: indexed_vec:: { IndexVec , Idx } ;
1615use std:: u32;
1716use rustc_target:: spec:: abi:: Abi ;
18- use syntax:: attr:: { self , UnwindAttr } ;
1917use syntax:: symbol:: kw;
2018use syntax_pos:: Span ;
2119
@@ -485,29 +483,6 @@ macro_rules! unpack {
485483 } ;
486484}
487485
488- fn should_abort_on_panic ( tcx : TyCtxt < ' _ > , fn_def_id : DefId , abi : Abi ) -> bool {
489- // Not callable from C, so we can safely unwind through these
490- if abi == Abi :: Rust || abi == Abi :: RustCall { return false ; }
491-
492- // Validate `#[unwind]` syntax regardless of platform-specific panic strategy
493- let attrs = & tcx. get_attrs ( fn_def_id) ;
494- let unwind_attr = attr:: find_unwind_attr ( Some ( tcx. sess . diagnostic ( ) ) , attrs) ;
495-
496- // We never unwind, so it's not relevant to stop an unwind
497- if tcx. sess . panic_strategy ( ) != PanicStrategy :: Unwind { return false ; }
498-
499- // We cannot add landing pads, so don't add one
500- if tcx. sess . no_landing_pads ( ) { return false ; }
501-
502- // This is a special case: some functions have a C abi but are meant to
503- // unwind anyway. Don't stop them.
504- match unwind_attr {
505- None => false , // FIXME(#58794)
506- Some ( UnwindAttr :: Allowed ) => false ,
507- Some ( UnwindAttr :: Aborts ) => true ,
508- }
509- }
510-
511486///////////////////////////////////////////////////////////////////////////
512487/// the main entry point for building MIR for a function
513488
@@ -599,7 +574,7 @@ where
599574 let source_info = builder. source_info ( span) ;
600575 let call_site_s = ( call_site_scope, source_info) ;
601576 unpack ! ( block = builder. in_scope( call_site_s, LintLevel :: Inherited , |builder| {
602- if should_abort_on_panic ( tcx, fn_def_id, abi) {
577+ if tcx. abort_on_panic_shim ( fn_def_id, abi) {
603578 builder. schedule_abort( ) ;
604579 }
605580
0 commit comments