@@ -30,10 +30,11 @@ fn should_explore(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
3030 Some ( Node :: Item ( ..) ) |
3131 Some ( Node :: ImplItem ( ..) ) |
3232 Some ( Node :: ForeignItem ( ..) ) |
33- Some ( Node :: TraitItem ( ..) ) =>
34- true ,
35- _ =>
36- false
33+ Some ( Node :: TraitItem ( ..) ) |
34+ Some ( Node :: Variant ( ..) ) |
35+ Some ( Node :: AnonConst ( ..) ) |
36+ Some ( Node :: Pat ( ..) ) => true ,
37+ _ => false
3738 }
3839}
3940
@@ -75,7 +76,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
7576 self . check_def_id ( res. def_id ( ) ) ;
7677 }
7778 _ if self . in_pat => { } ,
78- Res :: PrimTy ( ..) | Res :: SelfTy ( .. ) | Res :: SelfCtor ( ..) |
79+ Res :: PrimTy ( ..) | Res :: SelfCtor ( ..) |
7980 Res :: Local ( ..) => { }
8081 Res :: Def ( DefKind :: Ctor ( CtorOf :: Variant , ..) , ctor_def_id) => {
8182 let variant_id = self . tcx . parent ( ctor_def_id) . unwrap ( ) ;
@@ -92,6 +93,14 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
9293 self . check_def_id ( variant_id) ;
9394 }
9495 }
96+ Res :: SelfTy ( t, i) => {
97+ if let Some ( t) = t {
98+ self . check_def_id ( t) ;
99+ }
100+ if let Some ( i) = i {
101+ self . check_def_id ( i) ;
102+ }
103+ }
95104 Res :: ToolMod | Res :: NonMacroAttr ( ..) | Res :: Err => { }
96105 _ => {
97106 self . check_def_id ( res. def_id ( ) ) ;
@@ -271,7 +280,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
271280 let res = self . tables . qpath_res ( path, pat. hir_id ) ;
272281 self . handle_field_pattern_match ( pat, res, fields) ;
273282 }
274- PatKind :: Path ( ref qpath @ hir :: QPath :: TypeRelative ( .. ) ) => {
283+ PatKind :: Path ( ref qpath) => {
275284 let res = self . tables . qpath_res ( qpath, pat. hir_id ) ;
276285 self . handle_res ( res) ;
277286 }
@@ -298,6 +307,11 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
298307 }
299308 intravisit:: walk_ty ( self , ty) ;
300309 }
310+
311+ fn visit_anon_const ( & mut self , c : & ' tcx hir:: AnonConst ) {
312+ self . live_symbols . insert ( c. hir_id ) ;
313+ intravisit:: walk_anon_const ( self , c) ;
314+ }
301315}
302316
303317fn has_allow_dead_code_or_lang_attr (
0 commit comments