File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
compiler/rustc_mir_build/src/build Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,20 @@ impl CoverageInfoBuilder {
168
168
// Bail out if branch coverage is not enabled.
169
169
let Some ( branch_info) = self . branch_info . as_mut ( ) else { return } ;
170
170
171
+
172
+ // Avoid duplicates coverage markers.
173
+ // When lowering match sub-branches (like or-patterns), `if` guards will
174
+ // be added multiple times for each sub-branch
175
+ // FIXME: This feels dirty. It would be nice to find a smarter way to avoid duplicate
176
+ // coverage markers.
177
+ for arms in & branch_info. branch_arm_lists {
178
+ for arm in arms {
179
+ if arm. span == source_info. span {
180
+ return ;
181
+ }
182
+ }
183
+ }
184
+
171
185
let true_marker = self . markers . inject_block_marker ( cfg, source_info, true_block) ;
172
186
let false_marker = self . markers . inject_block_marker ( cfg, source_info, false_block) ;
173
187
You can’t perform that action at this time.
0 commit comments