@@ -10,7 +10,6 @@ use rustc_middle::bug;
1010use rustc_middle:: middle:: codegen_fn_attrs:: { CodegenFnAttrFlags , CodegenFnAttrs } ;
1111use rustc_middle:: mir:: visit:: * ;
1212use rustc_middle:: mir:: * ;
13- use rustc_middle:: ty:: TypeVisitableExt ;
1413use rustc_middle:: ty:: { self , Instance , InstanceKind , ParamEnv , Ty , TyCtxt } ;
1514use rustc_session:: config:: { DebugInfo , OptLevel } ;
1615use rustc_span:: source_map:: Spanned ;
@@ -205,7 +204,7 @@ impl<'tcx> Inliner<'tcx> {
205204 }
206205 }
207206
208- let callee_body = try_instance_mir ( self . tcx , callsite. callee . def ) ? ;
207+ let callee_body = self . tcx . instance_mir ( callsite. callee . def ) ;
209208 self . check_mir_body ( callsite, callee_body, callee_attrs, cross_crate_inlinable) ?;
210209
211210 if !self . tcx . consider_optimizing ( || {
@@ -1090,26 +1089,6 @@ impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
10901089 }
10911090}
10921091
1093- #[ instrument( skip( tcx) , level = "debug" ) ]
1094- fn try_instance_mir < ' tcx > (
1095- tcx : TyCtxt < ' tcx > ,
1096- instance : InstanceKind < ' tcx > ,
1097- ) -> Result < & ' tcx Body < ' tcx > , & ' static str > {
1098- if let ty:: InstanceKind :: DropGlue ( _, Some ( ty) )
1099- | ty:: InstanceKind :: AsyncDropGlueCtorShim ( _, Some ( ty) ) = instance
1100- && let ty:: Adt ( def, args) = ty. kind ( )
1101- {
1102- let fields = def. all_fields ( ) ;
1103- for field in fields {
1104- let field_ty = field. ty ( tcx, args) ;
1105- if field_ty. has_param ( ) && field_ty. has_aliases ( ) {
1106- return Err ( "cannot build drop shim for polymorphic type" ) ;
1107- }
1108- }
1109- }
1110- Ok ( tcx. instance_mir ( instance) )
1111- }
1112-
11131092fn body_is_forwarder ( body : & Body < ' _ > ) -> bool {
11141093 let TerminatorKind :: Call { target, .. } = body. basic_blocks [ START_BLOCK ] . terminator ( ) . kind
11151094 else {
0 commit comments