@@ -565,8 +565,7 @@ impl<'tcx> Inliner<'tcx> {
565565 mut callee_body : Body < ' tcx > ,
566566 ) {
567567 let terminator = caller_body[ callsite. block ] . terminator . take ( ) . unwrap ( ) ;
568- let TerminatorKind :: Call { func, args, destination, unwind, target, .. } = terminator. kind
569- else {
568+ let TerminatorKind :: Call { args, destination, unwind, target, .. } = terminator. kind else {
570569 bug ! ( "unexpected terminator kind {:?}" , terminator. kind) ;
571570 } ;
572571
@@ -705,42 +704,6 @@ impl<'tcx> Inliner<'tcx> {
705704 source_info : callsite. source_info ,
706705 kind : TerminatorKind :: Goto { target : integrator. map_block ( START_BLOCK ) } ,
707706 } ) ;
708-
709- // Copy only unevaluated constants from the callee_body into the caller_body.
710- // Although we are only pushing `ConstKind::Unevaluated` consts to
711- // `required_consts`, here we may not only have `ConstKind::Unevaluated`
712- // because we are calling `instantiate_and_normalize_erasing_regions`.
713- caller_body. required_consts . extend ( callee_body. required_consts . iter ( ) . copied ( ) . filter (
714- |& ct| match ct. const_ {
715- Const :: Ty ( _) => {
716- bug ! ( "should never encounter ty::UnevaluatedConst in `required_consts`" )
717- }
718- Const :: Val ( ..) | Const :: Unevaluated ( ..) => true ,
719- } ,
720- ) ) ;
721- // Now that we incorporated the callee's `required_consts`, we can remove the callee from
722- // `mentioned_items` -- but we have to take their `mentioned_items` in return.
723- // This does some extra work here to save the monomorphization collector work later.
724- // FIXME: benchmark which option is better.
725- let callee_item = {
726- // We need to reconstruct the `required_item` for the callee so that we can find and
727- // remove it.
728- let func_ty = func. ty ( caller_body, self . tcx ) ;
729- match func_ty. kind ( ) {
730- ty:: FnDef ( def_id, args) => MentionedItem :: Fn ( * def_id, args) ,
731- _ => bug ! ( ) ,
732- }
733- } ;
734- if let Some ( idx) =
735- caller_body. mentioned_items . iter ( ) . position ( |item| item. node == callee_item)
736- {
737- // We found the callee, so remove it and add its items instead.
738- caller_body. mentioned_items . remove ( idx) ;
739- caller_body. mentioned_items . extend ( callee_body. mentioned_items ) ;
740- } else {
741- // If we can't find the callee, there's no point in adding its items.
742- // Probably it already got removed by being inlined elsewhere in the same function.
743- }
744707 }
745708
746709 fn make_call_args (
0 commit comments