@@ -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 } ;
@@ -79,7 +78,7 @@ struct MarkSymbolVisitor<'tcx> {
79
78
worklist : Vec < ( LocalDefId , ComesFromAllowExpect ) > ,
80
79
tcx : TyCtxt < ' tcx > ,
81
80
maybe_typeck_results : Option < & ' tcx ty:: TypeckResults < ' tcx > > ,
82
- scanned : UnordSet < ( LocalDefId , ComesFromAllowExpect ) > ,
81
+ scanned : LocalDefIdSet ,
83
82
live_symbols : LocalDefIdSet ,
84
83
repr_unconditionally_treats_fields_as_live : bool ,
85
84
repr_has_repr_simd : bool ,
@@ -323,18 +322,8 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
323
322
324
323
fn mark_live_symbols ( & mut self ) {
325
324
while let Some ( work) = self . worklist . pop ( ) {
326
- if !self . scanned . insert ( work) {
327
- continue ;
328
- }
329
-
330
325
let ( mut id, comes_from_allow_expect) = work;
331
326
332
- // Avoid accessing the HIR for the synthesized associated type generated for RPITITs.
333
- if self . tcx . is_impl_trait_in_trait ( id. to_def_id ( ) ) {
334
- self . live_symbols . insert ( id) ;
335
- continue ;
336
- }
337
-
338
327
// in the case of tuple struct constructors we want to check the item,
339
328
// not the generated tuple struct constructor function
340
329
if let DefKind :: Ctor ( ..) = self . tcx . def_kind ( id) {
@@ -362,9 +351,23 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
362
351
// this "duplication" is essential as otherwise a function with `#[expect]`
363
352
// called from a `pub fn` may be falsely reported as not live, falsely
364
353
// triggering the `unfulfilled_lint_expectations` lint.
365
- if comes_from_allow_expect != ComesFromAllowExpect :: Yes {
354
+ match comes_from_allow_expect {
355
+ ComesFromAllowExpect :: Yes => { }
356
+ ComesFromAllowExpect :: No => {
357
+ self . live_symbols . insert ( id) ;
358
+ }
359
+ }
360
+
361
+ if !self . scanned . insert ( id) {
362
+ continue ;
363
+ }
364
+
365
+ // Avoid accessing the HIR for the synthesized associated type generated for RPITITs.
366
+ if self . tcx . is_impl_trait_in_trait ( id. to_def_id ( ) ) {
366
367
self . live_symbols . insert ( id) ;
368
+ continue ;
367
369
}
370
+
368
371
self . visit_node ( self . tcx . hir_node_by_def_id ( id) ) ;
369
372
}
370
373
}
0 commit comments