@@ -207,7 +207,7 @@ use syntax_pos::DUMMY_SP;
207
207
use base:: custom_coerce_unsize_info;
208
208
use callee:: needs_fn_once_adapter_shim;
209
209
use context:: SharedCrateContext ;
210
- use common:: fulfill_obligation;
210
+ use common:: { def_ty , fulfill_obligation} ;
211
211
use glue:: { self , DropGlueKind } ;
212
212
use monomorphize:: { self , Instance } ;
213
213
use util:: nodemap:: { FxHashSet , FxHashMap , DefIdMap } ;
@@ -341,7 +341,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(scx: &SharedCrateContext<'a, 'tcx>,
341
341
// Sanity check whether this ended up being collected accidentally
342
342
debug_assert ! ( should_trans_locally( scx. tcx( ) , def_id) ) ;
343
343
344
- let ty = scx. tcx ( ) . item_type ( def_id ) ;
344
+ let ty = def_ty ( scx, def_id , Substs :: empty ( ) ) ;
345
345
let ty = glue:: get_drop_glue_type ( scx, ty) ;
346
346
neighbors. push ( TransItem :: DropGlue ( DropGlueKind :: Ty ( ty) ) ) ;
347
347
@@ -815,10 +815,7 @@ fn find_drop_glue_neighbors<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
815
815
}
816
816
ty:: TyAdt ( def, substs) => {
817
817
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) ;
822
819
let field_type = glue:: get_drop_glue_type ( scx, field_type) ;
823
820
824
821
if scx. type_needs_drop ( field_type) {
@@ -1184,7 +1181,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> {
1184
1181
debug ! ( "RootCollector: ADT drop-glue for {}" ,
1185
1182
def_id_to_string( self . scx. tcx( ) , def_id) ) ;
1186
1183
1187
- let ty = self . scx . tcx ( ) . item_type ( def_id ) ;
1184
+ let ty = def_ty ( self . scx , def_id , Substs :: empty ( ) ) ;
1188
1185
let ty = glue:: get_drop_glue_type ( self . scx , ty) ;
1189
1186
self . output . push ( TransItem :: DropGlue ( DropGlueKind :: Ty ( ty) ) ) ;
1190
1187
}
0 commit comments