Skip to content

Commit 3f90bb1

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

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

compiler/rustc_mir_transform/src/coverage/counters.rs

+4-4
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) enum BcbCounter {
16+
enum BcbCounter {
1717
Counter { id: CounterId },
1818
Expression { id: ExpressionId },
1919
}
2020

2121
impl BcbCounter {
22-
pub(super) fn as_term(&self) -> CovTerm {
22+
fn as_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) fn bcb_counter(&self, bcb: BasicCoverageBlock) -> Option<BcbCounter> {
222-
self.bcb_counters[bcb]
221+
pub(super) fn term_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

+2-6
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)