@@ -86,20 +86,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
8686 }
8787 }
8888
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 ) {
10390 match def {
10491 Def :: Const ( _) | Def :: AssociatedConst ( ..) => {
10592 self . check_def_id ( def. def_id ( ) ) ;
@@ -241,7 +228,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
241228 match expr. node {
242229 hir:: ExprPath ( ref qpath @ hir:: QPath :: TypeRelative ( ..) ) => {
243230 let def = self . tcx . tables ( ) . qpath_def ( qpath, expr. id ) ;
244- self . handle_definition ( expr . id , def) ;
231+ self . handle_definition ( def) ;
245232 }
246233 hir:: ExprMethodCall ( ..) => {
247234 self . lookup_and_handle_method ( expr. id ) ;
@@ -281,7 +268,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
281268 }
282269 PatKind :: Path ( ref qpath @ hir:: QPath :: TypeRelative ( ..) ) => {
283270 let def = self . tcx . tables ( ) . qpath_def ( qpath, pat. id ) ;
284- self . handle_definition ( pat . id , def) ;
271+ self . handle_definition ( def) ;
285272 }
286273 _ => ( )
287274 }
@@ -291,8 +278,8 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
291278 self . ignore_non_const_paths = false ;
292279 }
293280
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 ) ;
296283 intravisit:: walk_path ( self , path) ;
297284 }
298285}
@@ -426,6 +413,7 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> {
426413 hir:: ItemStatic ( ..)
427414 | hir:: ItemConst ( ..)
428415 | hir:: ItemFn ( ..)
416+ | hir:: ItemTy ( ..)
429417 | hir:: ItemEnum ( ..)
430418 | hir:: ItemStruct ( ..)
431419 | hir:: ItemUnion ( ..) => true ,
0 commit comments