about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-15 19:44:22 +0000
committerbors <bors@rust-lang.org>2024-07-15 19:44:22 +0000
commit24d2ac0b56fcbde13d827745f66e73efb1e17156 (patch)
tree9fbe3038a35c79c8ee02c2e6d6402e6a90397f7e /compiler/rustc_codegen_llvm/src
parenteb72697e41b00e5d8723f14c64a969d59d9b9474 (diff)
parente5d65e46ed2734b0c20aa9d8159c1b31121a72ef (diff)
downloadrust-24d2ac0b56fcbde13d827745f66e73efb1e17156.tar.gz
rust-24d2ac0b56fcbde13d827745f66e73efb1e17156.zip
Auto merge of #127777 - matthiaskrgr:rollup-qp2vkan, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #124921 (offset_from: always allow pointers to point to the same address)
 - #127407 (Make parse error suggestions verbose and fix spans)
 - #127684 (consolidate miri-unleashed tests for mutable refs into one file)
 - #127729 (Stop using the `gen` identifier in the compiler)
 - #127736 (Add myself to the review rotation)
 - #127758 (coverage: Restrict `ExpressionUsed` simplification to `Code` mappings)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs
index b969fe27a99..14a94468587 100644
--- a/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs
+++ b/compiler/rustc_codegen_llvm/src/coverageinfo/map_data.rs
@@ -66,8 +66,15 @@ impl<'tcx> FunctionCoverageCollector<'tcx> {
         // For each expression ID that is directly used by one or more mappings,
         // mark it as not-yet-seen. This indicates that we expect to see a
         // corresponding `ExpressionUsed` statement during MIR traversal.
-        for term in function_coverage_info.mappings.iter().flat_map(|m| m.kind.terms()) {
-            if let CovTerm::Expression(id) = term {
+        for mapping in function_coverage_info.mappings.iter() {
+            // Currently we only worry about ordinary code mappings.
+            // For branch and MC/DC mappings, expressions might not correspond
+            // to any particular point in the control-flow graph.
+            // (Keep this in sync with the injection of `ExpressionUsed`
+            // statements in the `InstrumentCoverage` MIR pass.)
+            if let MappingKind::Code(term) = mapping.kind
+                && let CovTerm::Expression(id) = term
+            {
                 expressions_seen.remove(id);
             }
         }