1
Fork 0

Allow SliceIndex to be indexed by ranges.

This commit is contained in:
Jason Newcomb 2025-02-21 16:01:19 -05:00
parent a74f3fb5fc
commit 162fb713ac
10 changed files with 121 additions and 22 deletions

View file

@ -47,7 +47,7 @@ fn make_node_flow_priority_list(
// A "reloop" node has exactly one out-edge, which jumps back to the top
// of an enclosing loop. Reloop nodes are typically visited more times
// than loop-exit nodes, so try to avoid giving them physical counters.
let is_reloop_node = IndexVec::from_fn_n(
let is_reloop_node = IndexVec::<BasicCoverageBlock, _>::from_fn_n(
|node| match graph.successors[node].as_slice() {
&[succ] => graph.dominates(succ, node),
_ => false,

View file

@ -42,7 +42,7 @@ impl CoverageGraph {
// `SwitchInt` to have multiple targets to the same destination `BasicBlock`, so
// de-duplication is required. This is done without reordering the successors.
let successors = IndexVec::from_fn_n(
let successors = IndexVec::<BasicCoverageBlock, _>::from_fn_n(
|bcb| {
let mut seen_bcbs = FxHashSet::default();
let terminator = mir_body[bcbs[bcb].last_bb()].terminator();