@@ -488,11 +488,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
488488 // available - right now `sig` is only needed for getthing the `abi`
489489 // and figuring out how many extra args were passed to a C-variadic `fn`.
490490 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 ( ) ;
496492
497493 // Handle intrinsics old codegen wants Expr's for, ourselves.
498494 let intrinsic = match def {
@@ -502,6 +498,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
502498 } ;
503499 let intrinsic = intrinsic. as_ref ( ) . map ( |s| & s[ ..] ) ;
504500
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+
505512 if intrinsic == Some ( "transmute" ) {
506513 if let Some ( destination_ref) = destination. as_ref ( ) {
507514 let & ( ref dest, target) = destination_ref;
@@ -515,23 +522,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
515522 // we can do what we like. Here, we declare that transmuting
516523 // into an uninhabited type is impossible, so anything following
517524 // 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 ) ;
519526 bx. unreachable ( ) ;
520527 }
521528 return ;
522529 }
523530
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-
535531 // Emit a panic or a no-op for `panic_if_uninhabited`.
536532 if intrinsic == Some ( "panic_if_uninhabited" ) {
537533 let ty = instance. unwrap ( ) . substs . type_at ( 0 ) ;
0 commit comments