@@ -10,7 +10,6 @@ use rustc_middle::bug;
10
10
use rustc_middle:: middle:: codegen_fn_attrs:: { CodegenFnAttrFlags , CodegenFnAttrs } ;
11
11
use rustc_middle:: mir:: visit:: * ;
12
12
use rustc_middle:: mir:: * ;
13
- use rustc_middle:: ty:: TypeVisitableExt ;
14
13
use rustc_middle:: ty:: { self , Instance , InstanceKind , ParamEnv , Ty , TyCtxt } ;
15
14
use rustc_session:: config:: { DebugInfo , OptLevel } ;
16
15
use rustc_span:: source_map:: Spanned ;
@@ -205,7 +204,7 @@ impl<'tcx> Inliner<'tcx> {
205
204
}
206
205
}
207
206
208
- let callee_body = try_instance_mir ( self . tcx , callsite. callee . def ) ? ;
207
+ let callee_body = self . tcx . instance_mir ( callsite. callee . def ) ;
209
208
self . check_mir_body ( callsite, callee_body, callee_attrs, cross_crate_inlinable) ?;
210
209
211
210
if !self . tcx . consider_optimizing ( || {
@@ -1090,26 +1089,6 @@ impl<'tcx> MutVisitor<'tcx> for Integrator<'_, 'tcx> {
1090
1089
}
1091
1090
}
1092
1091
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
-
1113
1092
fn body_is_forwarder ( body : & Body < ' _ > ) -> bool {
1114
1093
let TerminatorKind :: Call { target, .. } = body. basic_blocks [ START_BLOCK ] . terminator ( ) . kind
1115
1094
else {
0 commit comments