1
Fork 0

coverage: Store bcb_needs_counter in a field as a bitset

This makes it possible for other parts of counter-assignment to check whether a
node is guaranteed to end up with some kind of counter.

Switching from `impl Fn` to a concrete `&BitSet` just avoids the hassle of
trying to store a closure in a struct field, and currently there's no
foreseeable need for this information to not be a bitset.
This commit is contained in:
Zalathar 2024-10-06 22:44:14 +11:00
parent c6e4fcd4fa
commit ab154e6999
2 changed files with 14 additions and 8 deletions

View file

@ -94,9 +94,8 @@ fn instrument_function_for_coverage<'tcx>(tcx: TyCtxt<'tcx>, mir_body: &mut mir:
return;
}
let bcb_has_counter_mappings = |bcb| bcbs_with_counter_mappings.contains(bcb);
let coverage_counters =
CoverageCounters::make_bcb_counters(&basic_coverage_blocks, bcb_has_counter_mappings);
CoverageCounters::make_bcb_counters(&basic_coverage_blocks, &bcbs_with_counter_mappings);
let mappings = create_mappings(tcx, &hir_info, &extracted_mappings, &coverage_counters);
if mappings.is_empty() {