11use super :: Error ;
22
3- use super :: debug;
43use super :: graph;
54use super :: spans;
65
7- use debug:: { DebugCounters , NESTED_INDENT } ;
86use graph:: { BasicCoverageBlock , BcbBranch , CoverageGraph , TraverseCoverageGraphWithLoops } ;
97use spans:: CoverageSpan ;
108
@@ -16,6 +14,8 @@ use rustc_middle::mir::coverage::*;
1614
1715use std:: fmt:: { self , Debug } ;
1816
17+ const NESTED_INDENT : & str = " " ;
18+
1919/// The coverage counter or counter expression associated with a particular
2020/// BCB node or BCB edge.
2121#[ derive( Clone ) ]
@@ -75,8 +75,6 @@ pub(super) struct CoverageCounters {
7575 /// BCB/edge, but are needed as operands to more complex expressions.
7676 /// These are always [`BcbCounter::Expression`].
7777 pub ( super ) intermediate_expressions : Vec < BcbCounter > ,
78-
79- pub debug_counters : DebugCounters ,
8078}
8179
8280impl CoverageCounters {
@@ -91,17 +89,9 @@ impl CoverageCounters {
9189 bcb_edge_counters : FxHashMap :: default ( ) ,
9290 bcb_has_incoming_edge_counters : BitSet :: new_empty ( num_bcbs) ,
9391 intermediate_expressions : Vec :: new ( ) ,
94-
95- debug_counters : DebugCounters :: new ( ) ,
9692 }
9793 }
9894
99- /// Activate the `DebugCounters` data structures, to provide additional debug formatting
100- /// features when formatting [`BcbCounter`] (counter) values.
101- pub fn enable_debug ( & mut self ) {
102- self . debug_counters . enable ( ) ;
103- }
104-
10595 /// Makes [`BcbCounter`] `Counter`s and `Expressions` for the `BasicCoverageBlock`s directly or
10696 /// indirectly associated with `CoverageSpans`, and accumulates additional `Expression`s
10797 /// representing intermediate values.
@@ -113,44 +103,30 @@ impl CoverageCounters {
113103 MakeBcbCounters :: new ( self , basic_coverage_blocks) . make_bcb_counters ( coverage_spans)
114104 }
115105
116- fn make_counter < F > ( & mut self , debug_block_label_fn : F ) -> BcbCounter
106+ fn make_counter < F > ( & mut self , _debug_block_label_fn : F ) -> BcbCounter
117107 where
118108 F : Fn ( ) -> Option < String > ,
119109 {
120- let counter = BcbCounter :: Counter { id : self . next_counter ( ) } ;
121- if self . debug_counters . is_enabled ( ) {
122- self . debug_counters . add_counter ( & counter, ( debug_block_label_fn) ( ) ) ;
123- }
124- counter
110+ let id = self . next_counter ( ) ;
111+ BcbCounter :: Counter { id }
125112 }
126113
127114 fn make_expression < F > (
128115 & mut self ,
129116 lhs : Operand ,
130117 op : Op ,
131118 rhs : Operand ,
132- debug_block_label_fn : F ,
119+ _debug_block_label_fn : F ,
133120 ) -> BcbCounter
134121 where
135122 F : Fn ( ) -> Option < String > ,
136123 {
137124 let id = self . next_expression ( ) ;
138- let expression = BcbCounter :: Expression { id, lhs, op, rhs } ;
139- if self . debug_counters . is_enabled ( ) {
140- self . debug_counters . add_counter ( & expression, ( debug_block_label_fn) ( ) ) ;
141- }
142- expression
125+ BcbCounter :: Expression { id, lhs, op, rhs }
143126 }
144127
145128 pub fn make_identity_counter ( & mut self , counter_operand : Operand ) -> BcbCounter {
146- let some_debug_block_label = if self . debug_counters . is_enabled ( ) {
147- self . debug_counters . some_block_label ( counter_operand) . cloned ( )
148- } else {
149- None
150- } ;
151- self . make_expression ( counter_operand, Op :: Add , Operand :: Zero , || {
152- some_debug_block_label. clone ( )
153- } )
129+ self . make_expression ( counter_operand, Op :: Add , Operand :: Zero , || unreachable ! ( ) )
154130 }
155131
156132 /// Counter IDs start from one and go up.
@@ -713,6 +689,6 @@ impl<'a> MakeBcbCounters<'a> {
713689
714690 #[ inline]
715691 fn format_counter ( & self , counter_kind : & BcbCounter ) -> String {
716- self . coverage_counters . debug_counters . format_counter ( counter_kind)
692+ format ! ( "{ counter_kind:?}" )
717693 }
718694}
0 commit comments