@@ -43,8 +43,9 @@ struct BcbExpression {
4343 rhs : BcbCounter ,
4444}
4545
46- #[ derive( Debug ) ]
47- pub ( super ) enum CounterIncrementSite {
46+ /// Enum representing either a node or an edge in the coverage graph.
47+ #[ derive( Clone , Copy , Debug ) ]
48+ pub ( super ) enum Site {
4849 Node { bcb : BasicCoverageBlock } ,
4950 Edge { from_bcb : BasicCoverageBlock , to_bcb : BasicCoverageBlock } ,
5051}
@@ -54,7 +55,7 @@ pub(super) enum CounterIncrementSite {
5455pub ( super ) struct CoverageCounters {
5556 /// List of places where a counter-increment statement should be injected
5657 /// into MIR, each with its corresponding counter ID.
57- counter_increment_sites : IndexVec < CounterId , CounterIncrementSite > ,
58+ counter_increment_sites : IndexVec < CounterId , Site > ,
5859
5960 /// Coverage counters/expressions that are associated with individual BCBs.
6061 node_counters : IndexVec < BasicCoverageBlock , Option < BcbCounter > > ,
@@ -98,14 +99,14 @@ impl CoverageCounters {
9899
99100 /// Shared helper used by [`Self::make_phys_node_counter`] and
100101 /// [`Self::make_phys_edge_counter`]. Don't call this directly.
101- fn make_counter_inner ( & mut self , site : CounterIncrementSite ) -> BcbCounter {
102+ fn make_counter_inner ( & mut self , site : Site ) -> BcbCounter {
102103 let id = self . counter_increment_sites . push ( site) ;
103104 BcbCounter :: Counter { id }
104105 }
105106
106107 /// Creates a new physical counter for a BCB node.
107108 fn make_phys_node_counter ( & mut self , bcb : BasicCoverageBlock ) -> BcbCounter {
108- self . make_counter_inner ( CounterIncrementSite :: Node { bcb } )
109+ self . make_counter_inner ( Site :: Node { bcb } )
109110 }
110111
111112 /// Creates a new physical counter for a BCB edge.
@@ -114,7 +115,7 @@ impl CoverageCounters {
114115 from_bcb : BasicCoverageBlock ,
115116 to_bcb : BasicCoverageBlock ,
116117 ) -> BcbCounter {
117- self . make_counter_inner ( CounterIncrementSite :: Edge { from_bcb, to_bcb } )
118+ self . make_counter_inner ( Site :: Edge { from_bcb, to_bcb } )
118119 }
119120
120121 fn make_expression ( & mut self , lhs : BcbCounter , op : Op , rhs : BcbCounter ) -> BcbCounter {
@@ -224,8 +225,8 @@ impl CoverageCounters {
224225 /// each site's corresponding counter ID.
225226 pub ( super ) fn counter_increment_sites (
226227 & self ,
227- ) -> impl Iterator < Item = ( CounterId , & CounterIncrementSite ) > {
228- self . counter_increment_sites . iter_enumerated ( )
228+ ) -> impl Iterator < Item = ( CounterId , Site ) > + Captures < ' _ > {
229+ self . counter_increment_sites . iter_enumerated ( ) . map ( | ( id , & site ) | ( id , site ) )
229230 }
230231
231232 /// Returns an iterator over the subset of BCB nodes that have been associated
0 commit comments