@@ -444,7 +444,9 @@ impl<'tcx> Inliner<'tcx> {
444444 work_list. push ( target) ;
445445
446446 // If the place doesn't actually need dropping, treat it like a regular goto.
447- let ty = callsite. callee . subst_mir ( self . tcx , & place. ty ( callee_body, tcx) . ty ) ;
447+ let ty = callsite
448+ . callee
449+ . subst_mir ( self . tcx , ty:: EarlyBinder ( & place. ty ( callee_body, tcx) . ty ) ) ;
448450 if ty. needs_drop ( tcx, self . param_env ) && let UnwindAction :: Cleanup ( unwind) = unwind {
449451 work_list. push ( unwind) ;
450452 }
@@ -788,7 +790,9 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
788790 match terminator. kind {
789791 TerminatorKind :: Drop { ref place, unwind, .. } => {
790792 // If the place doesn't actually need dropping, treat it like a regular goto.
791- let ty = self . instance . subst_mir ( tcx, & place. ty ( self . callee_body , tcx) . ty ) ;
793+ let ty = self
794+ . instance
795+ . subst_mir ( tcx, ty:: EarlyBinder ( & place. ty ( self . callee_body , tcx) . ty ) ) ;
792796 if ty. needs_drop ( tcx, self . param_env ) {
793797 self . cost += CALL_PENALTY ;
794798 if let UnwindAction :: Cleanup ( _) = unwind {
@@ -799,7 +803,7 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
799803 }
800804 }
801805 TerminatorKind :: Call { func : Operand :: Constant ( ref f) , unwind, .. } => {
802- let fn_ty = self . instance . subst_mir ( tcx, & f. literal . ty ( ) ) ;
806+ let fn_ty = self . instance . subst_mir ( tcx, ty :: EarlyBinder ( & f. literal . ty ( ) ) ) ;
803807 self . cost += if let ty:: FnDef ( def_id, _) = * fn_ty. kind ( ) && tcx. is_intrinsic ( def_id) {
804808 // Don't give intrinsics the extra penalty for calls
805809 INSTR_COST
0 commit comments