@@ -86,20 +86,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
86
86
}
87
87
}
88
88
89
- fn handle_definition ( & mut self , id : ast:: NodeId , def : Def ) {
90
- // If `bar` is a trait item, make sure to mark Foo as alive in `Foo::bar`
91
- match def {
92
- Def :: AssociatedTy ( ..) | Def :: Method ( _) | Def :: AssociatedConst ( _)
93
- if self . tcx . trait_of_item ( def. def_id ( ) ) . is_some ( ) => {
94
- if let Some ( substs) = self . tcx . tables ( ) . item_substs . get ( & id) {
95
- if let ty:: TyAdt ( tyid, _) = substs. substs . type_at ( 0 ) . sty {
96
- self . check_def_id ( tyid. did ) ;
97
- }
98
- }
99
- }
100
- _ => { }
101
- }
102
-
89
+ fn handle_definition ( & mut self , def : Def ) {
103
90
match def {
104
91
Def :: Const ( _) | Def :: AssociatedConst ( ..) => {
105
92
self . check_def_id ( def. def_id ( ) ) ;
@@ -241,7 +228,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
241
228
match expr. node {
242
229
hir:: ExprPath ( ref qpath @ hir:: QPath :: TypeRelative ( ..) ) => {
243
230
let def = self . tcx . tables ( ) . qpath_def ( qpath, expr. id ) ;
244
- self . handle_definition ( expr . id , def) ;
231
+ self . handle_definition ( def) ;
245
232
}
246
233
hir:: ExprMethodCall ( ..) => {
247
234
self . lookup_and_handle_method ( expr. id ) ;
@@ -281,7 +268,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
281
268
}
282
269
PatKind :: Path ( ref qpath @ hir:: QPath :: TypeRelative ( ..) ) => {
283
270
let def = self . tcx . tables ( ) . qpath_def ( qpath, pat. id ) ;
284
- self . handle_definition ( pat . id , def) ;
271
+ self . handle_definition ( def) ;
285
272
}
286
273
_ => ( )
287
274
}
@@ -291,8 +278,8 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
291
278
self . ignore_non_const_paths = false ;
292
279
}
293
280
294
- fn visit_path ( & mut self , path : & ' tcx hir:: Path , id : ast:: NodeId ) {
295
- self . handle_definition ( id , path. def ) ;
281
+ fn visit_path ( & mut self , path : & ' tcx hir:: Path , _ : ast:: NodeId ) {
282
+ self . handle_definition ( path. def ) ;
296
283
intravisit:: walk_path ( self , path) ;
297
284
}
298
285
}
@@ -426,6 +413,7 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> {
426
413
hir:: ItemStatic ( ..)
427
414
| hir:: ItemConst ( ..)
428
415
| hir:: ItemFn ( ..)
416
+ | hir:: ItemTy ( ..)
429
417
| hir:: ItemEnum ( ..)
430
418
| hir:: ItemStruct ( ..)
431
419
| hir:: ItemUnion ( ..) => true ,
0 commit comments