Skip to content

Commit

Permalink
Fixed a bug that prevent MCDC coverage from running if branch coverag…
Browse files Browse the repository at this point in the history
…e is not also enabled
  • Loading branch information
ranger-ross committed Sep 26, 2024
1 parent 7e4c8ec commit 1fad5de
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_mir_build/src/build/coverageinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ impl CoverageInfoBuilder {
true_block: BasicBlock,
false_block: BasicBlock,
) {
// Bail out if branch coverage is not enabled.
let Some(branch_info) = self.branch_info.as_mut() else { return };

// Separate path for handling branches when MC/DC is enabled.
if let Some(mcdc_info) = self.mcdc_info.as_mut() {
let inject_block_marker =
Expand All @@ -168,6 +165,9 @@ impl CoverageInfoBuilder {
inject_block_marker,
);
} else {
// Bail out if branch coverage is not enabled.
let Some(branch_info) = self.branch_info.as_mut() else { return };

let true_marker = self.markers.inject_block_marker(cfg, source_info, true_block);
let false_marker = self.markers.inject_block_marker(cfg, source_info, false_block);

Expand Down

0 comments on commit 1fad5de

Please sign in to comment.