@@ -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 } ;
@@ -79,7 +78,7 @@ struct MarkSymbolVisitor<'tcx> {
7978 worklist : Vec < ( LocalDefId , ComesFromAllowExpect ) > ,
8079 tcx : TyCtxt < ' tcx > ,
8180 maybe_typeck_results : Option < & ' tcx ty:: TypeckResults < ' tcx > > ,
82- scanned : UnordSet < ( LocalDefId , ComesFromAllowExpect ) > ,
81+ scanned : LocalDefIdSet ,
8382 live_symbols : LocalDefIdSet ,
8483 repr_unconditionally_treats_fields_as_live : bool ,
8584 repr_has_repr_simd : bool ,
@@ -321,18 +320,8 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
321320
322321 fn mark_live_symbols ( & mut self ) {
323322 while let Some ( work) = self . worklist . pop ( ) {
324- if !self . scanned . insert ( work) {
325- continue ;
326- }
327-
328323 let ( mut id, comes_from_allow_expect) = work;
329324
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-
336325 // in the case of tuple struct constructors we want to check the item,
337326 // not the generated tuple struct constructor function
338327 if let DefKind :: Ctor ( ..) = self . tcx . def_kind ( id) {
@@ -360,9 +349,23 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
360349 // this "duplication" is essential as otherwise a function with `#[expect]`
361350 // called from a `pub fn` may be falsely reported as not live, falsely
362351 // 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 ( ) ) {
364365 self . live_symbols . insert ( id) ;
366+ continue ;
365367 }
368+
366369 self . visit_node ( self . tcx . hir_node_by_def_id ( id) ) ;
367370 }
368371 }
0 commit comments