Skip to content

Commit 3f90bb1

Browse files
committed
coverage: Make BcbCounter module-private
1 parent 68301a6 commit 3f90bb1

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

‎compiler/rustc_mir_transform/src/coverage/counters.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph, TraverseCoverage
1313
/// The coverage counter or counter expression associated with a particular
1414
/// BCB node or BCB edge.
1515
#[derive(Clone,Copy,PartialEq,Eq,Hash)]
16-
pub(super)enumBcbCounter{
16+
enumBcbCounter{
1717
Counter{id:CounterId},
1818
Expression{id:ExpressionId},
1919
}
2020

2121
implBcbCounter{
22-
pub(super)fnas_term(&self) -> CovTerm{
22+
fnas_term(&self) -> CovTerm{
2323
match*self{
2424
BcbCounter::Counter{ id, .. } => CovTerm::Counter(id),
2525
BcbCounter::Expression{ id, .. } => CovTerm::Expression(id),
@@ -218,8 +218,8 @@ impl CoverageCounters {
218218
}
219219
}
220220

221-
pub(super)fnbcb_counter(&self,bcb:BasicCoverageBlock) -> Option<BcbCounter>{
222-
self.bcb_counters[bcb]
221+
pub(super)fnterm_for_bcb(&self,bcb:BasicCoverageBlock) -> Option<CovTerm>{
222+
self.bcb_counters[bcb].map(|counter| counter.as_term())
223223
}
224224

225225
/// Returns an iterator over all the nodes/edges in the coverage graph that

‎compiler/rustc_mir_transform/src/coverage/mod.rs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,8 @@ fn create_mappings<'tcx>(
153153
&source_file.name.for_scope(tcx.sess,RemapPathScopeComponents::MACRO).to_string_lossy(),
154154
);
155155

156-
let term_for_bcb = |bcb| {
157-
coverage_counters
158-
.bcb_counter(bcb)
159-
.expect("all BCBs with spans were given counters")
160-
.as_term()
161-
};
156+
let term_for_bcb =
157+
|bcb| coverage_counters.term_for_bcb(bcb).expect("all BCBs with spans were given counters");
162158
let region_for_span = |span:Span| make_source_region(source_map, file_name, span, body_span);
163159

164160
// Fully destructure the mappings struct to make sure we don't miss any kinds.

0 commit comments

Comments
 (0)