@@ -207,7 +207,7 @@ use syntax_pos::DUMMY_SP;
207207use base:: custom_coerce_unsize_info;
208208use callee:: needs_fn_once_adapter_shim;
209209use context:: SharedCrateContext ;
210- use common:: fulfill_obligation;
210+ use common:: { def_ty , fulfill_obligation} ;
211211use glue:: { self , DropGlueKind } ;
212212use monomorphize:: { self , Instance } ;
213213use util:: nodemap:: { FxHashSet , FxHashMap , DefIdMap } ;
@@ -341,7 +341,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(scx: &SharedCrateContext<'a, 'tcx>,
341341 // Sanity check whether this ended up being collected accidentally
342342 debug_assert ! ( should_trans_locally( scx. tcx( ) , def_id) ) ;
343343
344- let ty = scx. tcx ( ) . item_type ( def_id ) ;
344+ let ty = def_ty ( scx, def_id , Substs :: empty ( ) ) ;
345345 let ty = glue:: get_drop_glue_type ( scx, ty) ;
346346 neighbors. push ( TransItem :: DropGlue ( DropGlueKind :: Ty ( ty) ) ) ;
347347
@@ -815,10 +815,7 @@ fn find_drop_glue_neighbors<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
815815 }
816816 ty:: TyAdt ( def, substs) => {
817817 for field in def. all_fields ( ) {
818- let field_type = scx. tcx ( ) . item_type ( field. did ) ;
819- let field_type = monomorphize:: apply_param_substs ( scx,
820- substs,
821- & field_type) ;
818+ let field_type = def_ty ( scx, field. did , substs) ;
822819 let field_type = glue:: get_drop_glue_type ( scx, field_type) ;
823820
824821 if scx. type_needs_drop ( field_type) {
@@ -1184,7 +1181,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> {
11841181 debug ! ( "RootCollector: ADT drop-glue for {}" ,
11851182 def_id_to_string( self . scx. tcx( ) , def_id) ) ;
11861183
1187- let ty = self . scx . tcx ( ) . item_type ( def_id ) ;
1184+ let ty = def_ty ( self . scx , def_id , Substs :: empty ( ) ) ;
11881185 let ty = glue:: get_drop_glue_type ( self . scx , ty) ;
11891186 self . output . push ( TransItem :: DropGlue ( DropGlueKind :: Ty ( ty) ) ) ;
11901187 }
0 commit comments