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