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