about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/mappings.rs
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-07-15 20:32:14 +1000
committerZalathar <Zalathar@users.noreply.github.com>2024-07-15 20:54:28 +1000
commitd4f1f9242624f007c48d358ae3f62d046dee8925 (patch)
tree834f94c69c4d9db55b74babc32f40e1836952341 /compiler/rustc_mir_transform/src/coverage/mappings.rs
parent741ed0164649290718d7a226d7d043aefa16e9e0 (diff)
downloadrust-d4f1f9242624f007c48d358ae3f62d046dee8925.tar.gz
rust-d4f1f9242624f007c48d358ae3f62d046dee8925.zip
coverage: Restrict `ExpressionUsed` simplification to `Code` mappings
In the future, branch and MC/DC mappings might have expressions that don't
correspond to any single point in the control-flow graph. That makes it
trickier to keep track of which expressions should expect an `ExpressionUsed`
node.

We therefore sidestep that complexity by only performing `ExpressionUsed`
simplification for expressions associated directly with ordinary `Code`
mappings.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/mappings.rs')
-rw-r--r--compiler/rustc_mir_transform/src/coverage/mappings.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/coverage/mappings.rs b/compiler/rustc_mir_transform/src/coverage/mappings.rs
index 578e1ae0b8a..2ac08ea85d2 100644
--- a/compiler/rustc_mir_transform/src/coverage/mappings.rs
+++ b/compiler/rustc_mir_transform/src/coverage/mappings.rs
@@ -159,6 +159,15 @@ impl ExtractedMappings {
 
         bcbs_with_counter_mappings
     }
+
+    /// Returns the set of BCBs that have one or more `Code` mappings.
+    pub(super) fn bcbs_with_ordinary_code_mappings(&self) -> BitSet<BasicCoverageBlock> {
+        let mut bcbs = BitSet::new_empty(self.num_bcbs);
+        for &CodeMapping { span: _, bcb } in &self.code_mappings {
+            bcbs.insert(bcb);
+        }
+        bcbs
+    }
 }
 
 fn resolve_block_markers(