@@ -341,14 +341,13 @@ pub(crate) fn codegen_terminator_call<'tcx>(
341
341
destination : Place < ' tcx > ,
342
342
target : Option < BasicBlock > ,
343
343
) {
344
- let fn_ty = fx. monomorphize ( func. ty ( fx. mir , fx. tcx ) ) ;
345
- let fn_sig =
346
- fx. tcx . normalize_erasing_late_bound_regions ( ParamEnv :: reveal_all ( ) , fn_ty. fn_sig ( fx. tcx ) ) ;
344
+ let func = codegen_operand ( fx, func) ;
345
+ let fn_sig = func. layout ( ) . ty . fn_sig ( fx. tcx ) ;
347
346
348
347
let ret_place = codegen_place ( fx, destination) ;
349
348
350
349
// Handle special calls like intrinsics and empty drop glue.
351
- let instance = if let ty:: FnDef ( def_id, substs) = * fn_ty . kind ( ) {
350
+ let instance = if let ty:: FnDef ( def_id, substs) = * func . layout ( ) . ty . kind ( ) {
352
351
let instance = ty:: Instance :: resolve ( fx. tcx , ty:: ParamEnv :: reveal_all ( ) , def_id, substs)
353
352
. unwrap ( )
354
353
. unwrap ( )
@@ -391,17 +390,17 @@ pub(crate) fn codegen_terminator_call<'tcx>(
391
390
None
392
391
} ;
393
392
394
- let extra_args = & args[ fn_sig. inputs ( ) . len ( ) ..] ;
393
+ let extra_args = & args[ fn_sig. inputs ( ) . skip_binder ( ) . len ( ) ..] ;
395
394
let extra_args = fx
396
395
. tcx
397
396
. mk_type_list ( extra_args. iter ( ) . map ( |op_arg| fx. monomorphize ( op_arg. ty ( fx. mir , fx. tcx ) ) ) ) ;
398
397
let fn_abi = if let Some ( instance) = instance {
399
398
RevealAllLayoutCx ( fx. tcx ) . fn_abi_of_instance ( instance, extra_args)
400
399
} else {
401
- RevealAllLayoutCx ( fx. tcx ) . fn_abi_of_fn_ptr ( fn_ty . fn_sig ( fx . tcx ) , extra_args)
400
+ RevealAllLayoutCx ( fx. tcx ) . fn_abi_of_fn_ptr ( fn_sig, extra_args)
402
401
} ;
403
402
404
- let is_cold = if fn_sig. abi == Abi :: RustCold {
403
+ let is_cold = if fn_sig. abi ( ) == Abi :: RustCold {
405
404
true
406
405
} else {
407
406
instance
@@ -418,7 +417,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
418
417
}
419
418
420
419
// Unpack arguments tuple for closures
421
- let mut args = if fn_sig. abi == Abi :: RustCall {
420
+ let mut args = if fn_sig. abi ( ) == Abi :: RustCall {
422
421
assert_eq ! ( args. len( ) , 2 , "rust-call abi requires two arguments" ) ;
423
422
let self_arg = codegen_call_argument_operand ( fx, & args[ 0 ] ) ;
424
423
let pack_arg = codegen_call_argument_operand ( fx, & args[ 1 ] ) ;
@@ -486,7 +485,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
486
485
fx. add_comment ( nop_inst, "indirect call" ) ;
487
486
}
488
487
489
- let func = codegen_operand ( fx , func) . load_scalar ( fx) ;
488
+ let func = func. load_scalar ( fx) ;
490
489
let sig = clif_sig_from_fn_abi ( fx. tcx , fx. target_config . default_call_conv , & fn_abi) ;
491
490
let sig = fx. bcx . import_signature ( sig) ;
492
491
@@ -517,11 +516,11 @@ pub(crate) fn codegen_terminator_call<'tcx>(
517
516
} ;
518
517
519
518
// FIXME find a cleaner way to support varargs
520
- if fn_sig. c_variadic {
521
- if !matches ! ( fn_sig. abi, Abi :: C { .. } ) {
519
+ if fn_sig. c_variadic ( ) {
520
+ if !matches ! ( fn_sig. abi( ) , Abi :: C { .. } ) {
522
521
fx. tcx . sess . span_fatal (
523
522
source_info. span ,
524
- & format ! ( "Variadic call for non-C abi {:?}" , fn_sig. abi) ,
523
+ & format ! ( "Variadic call for non-C abi {:?}" , fn_sig. abi( ) ) ,
525
524
) ;
526
525
}
527
526
let sig_ref = fx. bcx . func . dfg . call_signature ( call_inst) . unwrap ( ) ;
0 commit comments