Skip to content

Commit ef2fc59

Browse files
committed
print: try harder to ensure DbgScope parents come before their children.
1 parent 1db5c95 commit ef2fc59

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/print/mod.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,9 +1382,14 @@ impl<'a> Printer<'a> {
13821382
// HACK(eddyb) also claim all yet-unclaimed parent scopes.
13831383
let stack = &mut reusable_dbg_scope_stack;
13841384
stack.clear();
1385-
stack.extend(
1386-
scope.parents(cx).take_while(|parent| !claimed.contains(parent)),
1387-
);
1385+
stack.extend(scope.parents(cx).take_while(|parent| {
1386+
claimed.get_index_of(parent).is_none_or(|parent_claim_idx| {
1387+
// HACK(eddyb) scopes later in `newly_claimed_range`
1388+
// get treated as unclaimed, in order to claim them
1389+
// even earlier (just before they're first needed).
1390+
parent_claim_idx > claim_idx
1391+
})
1392+
}));
13881393
for parent in stack.drain(..).rev() {
13891394
placements.insert(parent);
13901395
}

0 commit comments

Comments
 (0)