@@ -12,7 +12,7 @@ use rustc_middle::bug;
1212use rustc_middle:: middle:: codegen_fn_attrs:: { CodegenFnAttrFlags , CodegenFnAttrs } ;
1313use rustc_middle:: mir:: visit:: * ;
1414use rustc_middle:: mir:: * ;
15- use rustc_middle:: ty:: { self , Instance , InstanceKind , ParamEnv , Ty , TyCtxt , TypeVisitableExt } ;
15+ use rustc_middle:: ty:: { self , Instance , InstanceKind , ParamEnv , Ty , TyCtxt } ;
1616use rustc_session:: config:: { DebugInfo , OptLevel } ;
1717use rustc_span:: source_map:: Spanned ;
1818use rustc_span:: sym;
@@ -205,7 +205,7 @@ impl<'tcx> Inliner<'tcx> {
205205 }
206206 }
207207
208- let callee_body = try_instance_mir ( self . tcx , callsite. callee . def ) ? ;
208+ let callee_body = self . tcx . instance_mir ( callsite. callee . def ) ;
209209 self . check_mir_body ( callsite, callee_body, callee_attrs, cross_crate_inlinable) ?;
210210
211211 if !self . tcx . consider_optimizing ( || {
@@ -1089,26 +1089,6 @@ impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
10891089 }
10901090}
10911091
1092- #[ instrument( skip( tcx) , level = "debug" ) ]
1093- fn try_instance_mir < ' tcx > (
1094- tcx : TyCtxt < ' tcx > ,
1095- instance : InstanceKind < ' tcx > ,
1096- ) -> Result < & ' tcx Body < ' tcx > , & ' static str > {
1097- if let ty:: InstanceKind :: DropGlue ( _, Some ( ty) )
1098- | ty:: InstanceKind :: AsyncDropGlueCtorShim ( _, Some ( ty) ) = instance
1099- && let ty:: Adt ( def, args) = ty. kind ( )
1100- {
1101- let fields = def. all_fields ( ) ;
1102- for field in fields {
1103- let field_ty = field. ty ( tcx, args) ;
1104- if field_ty. has_param ( ) && field_ty. has_aliases ( ) {
1105- return Err ( "cannot build drop shim for polymorphic type" ) ;
1106- }
1107- }
1108- }
1109- Ok ( tcx. instance_mir ( instance) )
1110- }
1111-
11121092fn body_is_forwarder ( body : & Body < ' _ > ) -> bool {
11131093 let TerminatorKind :: Call { target, .. } = body. basic_blocks [ START_BLOCK ] . terminator ( ) . kind
11141094 else {
0 commit comments