@@ -6,15 +6,16 @@ use rustc::hir::CodegenFnAttrFlags;
6
6
use rustc:: hir:: def_id:: { DefId , LOCAL_CRATE } ;
7
7
use rustc:: session:: Session ;
8
8
use rustc:: session:: config:: { Sanitizer , OptLevel } ;
9
- use rustc:: ty:: { self , TyCtxt } ;
9
+ use rustc:: ty:: { self , TyCtxt , Ty } ;
10
10
use rustc:: ty:: layout:: HasTyCtxt ;
11
11
use rustc:: ty:: query:: Providers ;
12
12
use rustc_data_structures:: small_c_str:: SmallCStr ;
13
13
use rustc_data_structures:: fx:: FxHashMap ;
14
+ use rustc_target:: abi:: call:: Conv ;
14
15
use rustc_target:: spec:: PanicStrategy ;
15
16
use rustc_codegen_ssa:: traits:: * ;
16
17
17
- use crate :: abi:: Abi ;
18
+ use crate :: abi:: FnAbi ;
18
19
use crate :: attributes;
19
20
use crate :: llvm:: { self , Attribute } ;
20
21
use crate :: llvm:: AttributePlace :: Function ;
@@ -203,6 +204,7 @@ pub fn from_fn_attrs(
203
204
cx : & CodegenCx < ' ll , ' tcx > ,
204
205
llfn : & ' ll Value ,
205
206
instance : ty:: Instance < ' tcx > ,
207
+ fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
206
208
) {
207
209
let codegen_fn_attrs = cx. tcx . codegen_fn_attrs ( instance. def_id ( ) ) ;
208
210
@@ -279,10 +281,7 @@ pub fn from_fn_attrs(
279
281
// Special attribute for allocator functions, which can't unwind.
280
282
false
281
283
} 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 {
286
285
// Any Rust method (or `extern "Rust" fn` or `extern
287
286
// "rust-call" fn`) is explicitly allowed to unwind
288
287
// (unless it has no-unwind attribute, handled above).
0 commit comments