@@ -17,7 +17,8 @@ const ID_SEPARATOR: &str = ",";
17
17
/// `CoverageKind` counter (to be added by `CoverageCounters::make_bcb_counters`), and an optional
18
18
/// set of additional counters--if needed--to count incoming edges, if there are more than one.
19
19
/// (These "edge counters" are eventually converted into new MIR `BasicBlock`s.)
20
- pub ( crate ) struct CoverageGraph {
20
+ #[ derive( Debug ) ]
21
+ pub ( super ) struct CoverageGraph {
21
22
bcbs : IndexVec < BasicCoverageBlock , BasicCoverageBlockData > ,
22
23
bb_to_bcb : IndexVec < BasicBlock , Option < BasicCoverageBlock > > ,
23
24
pub successors : IndexVec < BasicCoverageBlock , Vec < BasicCoverageBlock > > ,
@@ -275,7 +276,7 @@ impl graph::WithPredecessors for CoverageGraph {
275
276
276
277
rustc_index:: newtype_index! {
277
278
/// A node in the [control-flow graph][CFG] of CoverageGraph.
278
- pub ( crate ) struct BasicCoverageBlock {
279
+ pub ( super ) struct BasicCoverageBlock {
279
280
DEBUG_FORMAT = "bcb{}" ,
280
281
}
281
282
}
@@ -305,7 +306,7 @@ rustc_index::newtype_index! {
305
306
/// queries (`is_dominated_by()`, `predecessors`, `successors`, etc.) have branch (control flow)
306
307
/// significance.
307
308
#[ derive( Debug , Clone ) ]
308
- pub ( crate ) struct BasicCoverageBlockData {
309
+ pub ( super ) struct BasicCoverageBlockData {
309
310
pub basic_blocks : Vec < BasicBlock > ,
310
311
pub counter_kind : Option < CoverageKind > ,
311
312
edge_from_bcbs : Option < FxHashMap < BasicCoverageBlock , CoverageKind > > ,
@@ -431,7 +432,7 @@ impl BasicCoverageBlockData {
431
432
/// the specific branching BCB, representing the edge between the two. The latter case
432
433
/// distinguishes this incoming edge from other incoming edges to the same `target_bcb`.
433
434
#[ derive( Clone , Copy , PartialEq , Eq ) ]
434
- pub ( crate ) struct BcbBranch {
435
+ pub ( super ) struct BcbBranch {
435
436
pub edge_from_bcb : Option < BasicCoverageBlock > ,
436
437
pub target_bcb : BasicCoverageBlock ,
437
438
}
@@ -498,9 +499,8 @@ fn bcb_filtered_successors<'a, 'tcx>(
498
499
/// Maintains separate worklists for each loop in the BasicCoverageBlock CFG, plus one for the
499
500
/// CoverageGraph outside all loops. This supports traversing the BCB CFG in a way that
500
501
/// ensures a loop is completely traversed before processing Blocks after the end of the loop.
501
- // FIXME(richkadel): Add unit tests for TraversalContext.
502
502
#[ derive( Debug ) ]
503
- pub ( crate ) struct TraversalContext {
503
+ pub ( super ) struct TraversalContext {
504
504
/// From one or more backedges returning to a loop header.
505
505
pub loop_backedges : Option < ( Vec < BasicCoverageBlock > , BasicCoverageBlock ) > ,
506
506
@@ -510,7 +510,7 @@ pub(crate) struct TraversalContext {
510
510
pub worklist : Vec < BasicCoverageBlock > ,
511
511
}
512
512
513
- pub ( crate ) struct TraverseCoverageGraphWithLoops {
513
+ pub ( super ) struct TraverseCoverageGraphWithLoops {
514
514
pub backedges : IndexVec < BasicCoverageBlock , Vec < BasicCoverageBlock > > ,
515
515
pub context_stack : Vec < TraversalContext > ,
516
516
visited : BitSet < BasicCoverageBlock > ,
@@ -642,7 +642,7 @@ impl TraverseCoverageGraphWithLoops {
642
642
}
643
643
}
644
644
645
- fn find_loop_backedges (
645
+ pub ( super ) fn find_loop_backedges (
646
646
basic_coverage_blocks : & CoverageGraph ,
647
647
) -> IndexVec < BasicCoverageBlock , Vec < BasicCoverageBlock > > {
648
648
let num_bcbs = basic_coverage_blocks. num_nodes ( ) ;
0 commit comments