1
Fork 0

coverage: Store a graph reference in the graph traversal struct

Having to keep passing in a graph reference was a holdover from when the graph
was partly mutated during traversal. As of #114354 that is no longer necessary,
so we can simplify the traversal code by storing a graph reference as a field
in `TraverseCoverageGraphWithLoops`.
This commit is contained in:
Zalathar 2023-10-11 17:40:37 +11:00
parent ea3fb7bc2c
commit 15360b3bc8
3 changed files with 16 additions and 17 deletions

View file

@ -628,7 +628,7 @@ fn test_traverse_coverage_with_loops() {
let basic_coverage_blocks = graph::CoverageGraph::from_mir(&mir_body);
let mut traversed_in_order = Vec::new();
let mut traversal = graph::TraverseCoverageGraphWithLoops::new(&basic_coverage_blocks);
while let Some(bcb) = traversal.next(&basic_coverage_blocks) {
while let Some(bcb) = traversal.next() {
traversed_in_order.push(bcb);
}