@@ -8,7 +8,6 @@ use std::mem;
88use hir:: def_id:: { LocalDefIdMap , LocalDefIdSet } ;
99use rustc_abi:: FieldIdx ;
1010use rustc_data_structures:: fx:: FxIndexSet ;
11- use rustc_data_structures:: unord:: UnordSet ;
1211use rustc_errors:: MultiSpan ;
1312use rustc_hir:: def:: { CtorOf , DefKind , Res } ;
1413use rustc_hir:: def_id:: { DefId , LocalDefId , LocalModDefId } ;
@@ -80,7 +79,7 @@ struct MarkSymbolVisitor<'tcx> {
8079 worklist : Vec < ( LocalDefId , ComesFromAllowExpect ) > ,
8180 tcx : TyCtxt < ' tcx > ,
8281 maybe_typeck_results : Option < & ' tcx ty:: TypeckResults < ' tcx > > ,
83- scanned : UnordSet < ( LocalDefId , ComesFromAllowExpect ) > ,
82+ scanned : LocalDefIdSet ,
8483 live_symbols : LocalDefIdSet ,
8584 repr_unconditionally_treats_fields_as_live : bool ,
8685 repr_has_repr_simd : bool ,
@@ -324,10 +323,6 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
324323
325324 fn mark_live_symbols ( & mut self ) {
326325 while let Some ( work) = self . worklist . pop ( ) {
327- if !self . scanned . insert ( work) {
328- continue ;
329- }
330-
331326 let ( mut id, comes_from_allow_expect) = work;
332327
333328 // Avoid accessing the HIR for the synthesized associated type generated for RPITITs.
@@ -363,9 +358,17 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
363358 // this "duplication" is essential as otherwise a function with `#[expect]`
364359 // called from a `pub fn` may be falsely reported as not live, falsely
365360 // triggering the `unfulfilled_lint_expectations` lint.
366- if comes_from_allow_expect != ComesFromAllowExpect :: Yes {
367- self . live_symbols . insert ( id) ;
361+ match comes_from_allow_expect {
362+ ComesFromAllowExpect :: Yes => { }
363+ ComesFromAllowExpect :: No => {
364+ self . live_symbols . insert ( id) ;
365+ }
368366 }
367+
368+ if !self . scanned . insert ( id) {
369+ continue ;
370+ }
371+
369372 self . visit_node ( self . tcx . hir_node_by_def_id ( id) ) ;
370373 }
371374 }
0 commit comments