Skip to content

Commit 377728a

Browse files
committed
Keep scanned set across calls to mark_live_symbols.
1 parent f601717 commit 377728a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_passes/src/dead.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ struct MarkSymbolVisitor<'tcx> {
8181
worklist: Vec<(LocalDefId, ComesFromAllowExpect)>,
8282
tcx: TyCtxt<'tcx>,
8383
maybe_typeck_results: Option<&'tcx ty::TypeckResults<'tcx>>,
84+
scanned: UnordSet<(LocalDefId, ComesFromAllowExpect)>,
8485
live_symbols: LocalDefIdSet,
8586
repr_unconditionally_treats_fields_as_live: bool,
8687
repr_has_repr_simd: bool,
@@ -323,9 +324,8 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
323324
}
324325

325326
fn mark_live_symbols(&mut self) {
326-
let mut scanned = UnordSet::default();
327327
while let Some(work) = self.worklist.pop() {
328-
if !scanned.insert(work) {
328+
if !self.scanned.insert(work) {
329329
continue;
330330
}
331331

@@ -830,6 +830,7 @@ fn live_symbols_and_ignored_derived_traits(
830830
worklist,
831831
tcx,
832832
maybe_typeck_results: None,
833+
scanned: Default::default(),
833834
live_symbols: Default::default(),
834835
repr_unconditionally_treats_fields_as_live: false,
835836
repr_has_repr_simd: false,

0 commit comments

Comments
 (0)