@@ -331,33 +331,10 @@ macro_rules! make_mir_visitor {
331331 self . visit_source_scope( $( & $mutability) ? * parent_scope) ;
332332 }
333333 if let Some ( ( callee, callsite_span) ) = inlined {
334- let location = Location :: START ;
335-
336334 self . visit_span( $( & $mutability) ? * callsite_span) ;
337-
338- let ty:: Instance { def: callee_def, args: callee_args } = callee;
339- match callee_def {
340- ty:: InstanceDef :: Item ( _def_id) => { }
341-
342- ty:: InstanceDef :: Intrinsic ( _def_id) |
343- ty:: InstanceDef :: VTableShim ( _def_id) |
344- ty:: InstanceDef :: ReifyShim ( _def_id) |
345- ty:: InstanceDef :: Virtual ( _def_id, _) |
346- ty:: InstanceDef :: ThreadLocalShim ( _def_id) |
347- ty:: InstanceDef :: ClosureOnceShim { call_once: _def_id, track_caller: _ } |
348- ty:: InstanceDef :: ConstructCoroutineInClosureShim { coroutine_closure_def_id: _def_id, target_kind: _ } |
349- ty:: InstanceDef :: CoroutineKindShim { coroutine_def_id: _def_id, target_kind: _ } |
350- ty:: InstanceDef :: DropGlue ( _def_id, None ) => { }
351-
352- ty:: InstanceDef :: FnPtrShim ( _def_id, ty) |
353- ty:: InstanceDef :: DropGlue ( _def_id, Some ( ty) ) |
354- ty:: InstanceDef :: CloneShim ( _def_id, ty) |
355- ty:: InstanceDef :: FnPtrAddrShim ( _def_id, ty) => {
356- // FIXME(eddyb) use a better `TyContext` here.
357- self . visit_ty( $( & $mutability) ? * ty, TyContext :: Location ( location) ) ;
358- }
359- }
360- self . visit_args( callee_args, location) ;
335+ let ty:: Instance { def, args } = callee;
336+ self . visit_instance_def( $( & $mutability) ? * def) ;
337+ self . visit_args( & $( $mutability) ? * args, Location :: START ) ;
361338 }
362339 if let Some ( inlined_parent_scope) = inlined_parent_scope {
363340 self . visit_source_scope( $( & $mutability) ? * inlined_parent_scope) ;
@@ -941,6 +918,31 @@ macro_rules! make_mir_visitor {
941918
942919 // Convenience methods
943920
921+ fn visit_instance_def( & mut self , def: $( & $mutability) ? ty:: InstanceDef <' tcx>) {
922+ let location = Location :: START ;
923+ match def {
924+ ty:: InstanceDef :: Item ( _def_id) => { }
925+
926+ ty:: InstanceDef :: Intrinsic ( _def_id) |
927+ ty:: InstanceDef :: VTableShim ( _def_id) |
928+ ty:: InstanceDef :: ReifyShim ( _def_id) |
929+ ty:: InstanceDef :: Virtual ( _def_id, _) |
930+ ty:: InstanceDef :: ThreadLocalShim ( _def_id) |
931+ ty:: InstanceDef :: ClosureOnceShim { call_once: _def_id, track_caller: _ } |
932+ ty:: InstanceDef :: ConstructCoroutineInClosureShim { coroutine_closure_def_id: _def_id, target_kind: _ } |
933+ ty:: InstanceDef :: CoroutineKindShim { coroutine_def_id: _def_id, target_kind: _ } |
934+ ty:: InstanceDef :: DropGlue ( _def_id, None ) => { }
935+
936+ ty:: InstanceDef :: FnPtrShim ( _def_id, ty) |
937+ ty:: InstanceDef :: DropGlue ( _def_id, Some ( ty) ) |
938+ ty:: InstanceDef :: CloneShim ( _def_id, ty) |
939+ ty:: InstanceDef :: FnPtrAddrShim ( _def_id, ty) => {
940+ // FIXME(eddyb) use a better `TyContext` here.
941+ self . visit_ty( $( & $mutability * ) ? ty, TyContext :: Location ( location) ) ;
942+ }
943+ }
944+ }
945+
944946 fn visit_location(
945947 & mut self ,
946948 body: & $( $mutability) ? Body <' tcx>,
0 commit comments