@@ -6,15 +6,16 @@ use rustc::hir::CodegenFnAttrFlags;
66use rustc:: hir:: def_id:: { DefId , LOCAL_CRATE } ;
77use rustc:: session:: Session ;
88use rustc:: session:: config:: { Sanitizer , OptLevel } ;
9- use rustc:: ty:: { self , TyCtxt } ;
9+ use rustc:: ty:: { self , TyCtxt , Ty } ;
1010use rustc:: ty:: layout:: HasTyCtxt ;
1111use rustc:: ty:: query:: Providers ;
1212use rustc_data_structures:: small_c_str:: SmallCStr ;
1313use rustc_data_structures:: fx:: FxHashMap ;
14+ use rustc_target:: abi:: call:: Conv ;
1415use rustc_target:: spec:: PanicStrategy ;
1516use rustc_codegen_ssa:: traits:: * ;
1617
17- use crate :: abi:: Abi ;
18+ use crate :: abi:: FnAbi ;
1819use crate :: attributes;
1920use crate :: llvm:: { self , Attribute } ;
2021use crate :: llvm:: AttributePlace :: Function ;
@@ -203,6 +204,7 @@ pub fn from_fn_attrs(
203204 cx : & CodegenCx < ' ll , ' tcx > ,
204205 llfn : & ' ll Value ,
205206 instance : ty:: Instance < ' tcx > ,
207+ fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
206208) {
207209 let codegen_fn_attrs = cx. tcx . codegen_fn_attrs ( instance. def_id ( ) ) ;
208210
@@ -279,10 +281,7 @@ pub fn from_fn_attrs(
279281 // Special attribute for allocator functions, which can't unwind.
280282 false
281283 } else {
282- // FIXME(eddyb) avoid this `Instance::fn_sig` call.
283- // Perhaps store the relevant information in `FnAbi`?
284- let abi = instance. fn_sig ( cx. tcx ( ) ) . abi ( ) ;
285- if abi == Abi :: Rust || abi == Abi :: RustCall {
284+ if fn_abi. conv == Conv :: Rust {
286285 // Any Rust method (or `extern "Rust" fn` or `extern
287286 // "rust-call" fn`) is explicitly allowed to unwind
288287 // (unless it has no-unwind attribute, handled above).
0 commit comments