@@ -8,7 +8,6 @@ use std::mem;
8
8
use hir:: def_id:: { LocalDefIdMap , LocalDefIdSet } ;
9
9
use rustc_abi:: FieldIdx ;
10
10
use rustc_data_structures:: fx:: FxIndexSet ;
11
- use rustc_data_structures:: unord:: UnordSet ;
12
11
use rustc_errors:: MultiSpan ;
13
12
use rustc_hir:: def:: { CtorOf , DefKind , Res } ;
14
13
use rustc_hir:: def_id:: { DefId , LocalDefId , LocalModDefId } ;
@@ -80,7 +79,7 @@ struct MarkSymbolVisitor<'tcx> {
80
79
worklist : Vec < ( LocalDefId , ComesFromAllowExpect ) > ,
81
80
tcx : TyCtxt < ' tcx > ,
82
81
maybe_typeck_results : Option < & ' tcx ty:: TypeckResults < ' tcx > > ,
83
- scanned : UnordSet < ( LocalDefId , ComesFromAllowExpect ) > ,
82
+ scanned : LocalDefIdSet ,
84
83
live_symbols : LocalDefIdSet ,
85
84
repr_unconditionally_treats_fields_as_live : bool ,
86
85
repr_has_repr_simd : bool ,
@@ -324,10 +323,6 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
324
323
325
324
fn mark_live_symbols ( & mut self ) {
326
325
while let Some ( work) = self . worklist . pop ( ) {
327
- if !self . scanned . insert ( work) {
328
- continue ;
329
- }
330
-
331
326
let ( mut id, comes_from_allow_expect) = work;
332
327
333
328
// Avoid accessing the HIR for the synthesized associated type generated for RPITITs.
@@ -363,9 +358,17 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
363
358
// this "duplication" is essential as otherwise a function with `#[expect]`
364
359
// called from a `pub fn` may be falsely reported as not live, falsely
365
360
// 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
+ }
368
366
}
367
+
368
+ if !self . scanned . insert ( id) {
369
+ continue ;
370
+ }
371
+
369
372
self . visit_node ( self . tcx . hir_node_by_def_id ( id) ) ;
370
373
}
371
374
}
0 commit comments