about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-29 20:11:09 +0000
committerbors <bors@rust-lang.org>2024-05-29 20:11:09 +0000
commitdebd22da66cfa97c74040ebf68e420672ac8560e (patch)
treeabb2e5ad3c4d30c15b364d3114729a89fea28675 /compiler/rustc_mir_build/src
parente9b7aa08f7cd890dcebd36c198193707d5cd3770 (diff)
parent6ef3dd0d383438770aed1faf37d3f15792aaa7aa (diff)
downloadrust-debd22da66cfa97c74040ebf68e420672ac8560e.tar.gz
rust-debd22da66cfa97c74040ebf68e420672ac8560e.zip
Auto merge of #125732 - matthiaskrgr:rollup-bozbtk3, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #124655 (Add `-Zfixed-x18`)
 - #125693 (Format all source files in `tests/coverage/`)
 - #125700 (coverage: Avoid overflow when the MC/DC condition limit is exceeded)
 - #125705 (Reintroduce name resolution check for trying to access locals from an inline const)
 - #125708 (tier 3 target policy: clarify the point about producing assembly)
 - #125715 (remove unneeded extern crate in rmake test)
 - #125719 (Extract coverage-specific code out of `compiletest::runtest`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_mir_build/src')
-rw-r--r--compiler/rustc_mir_build/src/build/coverageinfo/mcdc.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_mir_build/src/build/coverageinfo/mcdc.rs b/compiler/rustc_mir_build/src/build/coverageinfo/mcdc.rs
index 9cfb25e663d..728b63d5b21 100644
--- a/compiler/rustc_mir_build/src/build/coverageinfo/mcdc.rs
+++ b/compiler/rustc_mir_build/src/build/coverageinfo/mcdc.rs
@@ -217,12 +217,13 @@ impl MCDCInfoBuilder {
                 }
                 _ => {
                     // Do not generate mcdc mappings and statements for decisions with too many conditions.
-                    let rebase_idx = self.branch_spans.len() - decision.conditions_num + 1;
+                    // Therefore, first erase the condition info of the (N-1) previous branch spans.
+                    let rebase_idx = self.branch_spans.len() - (decision.conditions_num - 1);
                     for branch in &mut self.branch_spans[rebase_idx..] {
                         branch.condition_info = None;
                     }
 
-                    // ConditionInfo of this branch shall also be reset.
+                    // Then, erase this last branch span's info too, for a total of N.
                     condition_info = None;
 
                     tcx.dcx().emit_warn(MCDCExceedsConditionNumLimit {