Skip to content

Commit

Permalink
Unrolled build for rust-lang#121484
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#121484 - Zalathar:this, r=oli-obk

coverage: Use variable name `this` in `CoverageGraph::from_mir`

A tiny little improvement, extracted from rust-lang#120013.

This makes it easier to see that we're manipulating the instance that is being constructed, and is a lot less verbose than `basic_coverage_blocks`.
  • Loading branch information
rust-timer committed Feb 23, 2024
2 parents ea2cc43 + 9137c1e commit 809c145
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions compiler/rustc_mir_transform/src/coverage/graph.rs
Expand Up @@ -52,19 +52,18 @@ impl CoverageGraph {
}
}

let mut basic_coverage_blocks =
Self { bcbs, bb_to_bcb, successors, predecessors, dominators: None };
let dominators = dominators::dominators(&basic_coverage_blocks);
basic_coverage_blocks.dominators = Some(dominators);
let mut this = Self { bcbs, bb_to_bcb, successors, predecessors, dominators: None };

this.dominators = Some(dominators::dominators(&this));

// The coverage graph's entry-point node (bcb0) always starts with bb0,
// which never has predecessors. Any other blocks merged into bcb0 can't
// have multiple (coverage-relevant) predecessors, so bcb0 always has
// zero in-edges.
assert!(basic_coverage_blocks[START_BCB].leader_bb() == mir::START_BLOCK);
assert!(basic_coverage_blocks.predecessors[START_BCB].is_empty());
assert!(this[START_BCB].leader_bb() == mir::START_BLOCK);
assert!(this.predecessors[START_BCB].is_empty());

basic_coverage_blocks
this
}

fn compute_basic_coverage_blocks(
Expand Down

0 comments on commit 809c145

Please sign in to comment.