@@ -488,11 +488,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
488
488
// available - right now `sig` is only needed for getthing the `abi`
489
489
// and figuring out how many extra args were passed to a C-variadic `fn`.
490
490
let sig = callee. layout . ty . fn_sig ( bx. tcx ( ) ) ;
491
- let sig = bx. tcx ( ) . normalize_erasing_late_bound_regions (
492
- ty:: ParamEnv :: reveal_all ( ) ,
493
- & sig,
494
- ) ;
495
- let abi = sig. abi ;
491
+ let abi = sig. abi ( ) ;
496
492
497
493
// Handle intrinsics old codegen wants Expr's for, ourselves.
498
494
let intrinsic = match def {
@@ -502,6 +498,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
502
498
} ;
503
499
let intrinsic = intrinsic. as_ref ( ) . map ( |s| & s[ ..] ) ;
504
500
501
+ let extra_args = & args[ sig. inputs ( ) . skip_binder ( ) . len ( ) ..] ;
502
+ let extra_args = extra_args. iter ( ) . map ( |op_arg| {
503
+ let op_ty = op_arg. ty ( self . mir , bx. tcx ( ) ) ;
504
+ self . monomorphize ( & op_ty)
505
+ } ) . collect :: < Vec < _ > > ( ) ;
506
+
507
+ let fn_abi = match instance {
508
+ Some ( instance) => FnAbi :: of_instance ( & bx, instance, & extra_args) ,
509
+ None => FnAbi :: of_fn_ptr ( & bx, sig, & extra_args)
510
+ } ;
511
+
505
512
if intrinsic == Some ( "transmute" ) {
506
513
if let Some ( destination_ref) = destination. as_ref ( ) {
507
514
let & ( ref dest, target) = destination_ref;
@@ -515,23 +522,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
515
522
// we can do what we like. Here, we declare that transmuting
516
523
// into an uninhabited type is impossible, so anything following
517
524
// it must be unreachable.
518
- assert_eq ! ( bx . layout_of ( sig . output ( ) ) . abi, layout:: Abi :: Uninhabited ) ;
525
+ assert_eq ! ( fn_abi . ret . layout . abi, layout:: Abi :: Uninhabited ) ;
519
526
bx. unreachable ( ) ;
520
527
}
521
528
return ;
522
529
}
523
530
524
- let extra_args = & args[ sig. inputs ( ) . len ( ) ..] ;
525
- let extra_args = extra_args. iter ( ) . map ( |op_arg| {
526
- let op_ty = op_arg. ty ( self . mir , bx. tcx ( ) ) ;
527
- self . monomorphize ( & op_ty)
528
- } ) . collect :: < Vec < _ > > ( ) ;
529
-
530
- let fn_abi = match instance {
531
- Some ( instance) => FnAbi :: of_instance ( & bx, instance, & extra_args) ,
532
- None => FnAbi :: of_fn_ptr ( & bx, sig, & extra_args)
533
- } ;
534
-
535
531
// Emit a panic or a no-op for `panic_if_uninhabited`.
536
532
if intrinsic == Some ( "panic_if_uninhabited" ) {
537
533
let ty = instance. unwrap ( ) . substs . type_at ( 0 ) ;
0 commit comments