about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/coverageinfo
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2023-11-23 11:50:39 +1100
committerZalathar <Zalathar@users.noreply.github.com>2023-12-08 22:40:49 +1100
commit44b47aa976d6a6bdd7eb1f99a8ee5270afbe993e (patch)
treec225d40ad992eeb9162d716f9f586efbd1c4d972 /compiler/rustc_codegen_llvm/src/coverageinfo
parentd2d742c4ccc8c18fe13bfc42b3a7b9b66486b294 (diff)
downloadrust-44b47aa976d6a6bdd7eb1f99a8ee5270afbe993e.tar.gz
rust-44b47aa976d6a6bdd7eb1f99a8ee5270afbe993e.zip
coverage: Add `CoverageKind::SpanMarker` for including extra spans in MIR
There are cases where coverage instrumentation wants to show a span for some
syntax element, but there is no MIR node that naturally carries that span, so
the instrumentor can't see it.

MIR building can now use this new kind of coverage statement to deliberately
include those spans in MIR, attached to a dummy statement that has no other
effect.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo')
-rw-r--r--compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
index 7d69756181a..8386f067baf 100644
--- a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
+++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
@@ -100,6 +100,9 @@ impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
 
         let Coverage { kind } = coverage;
         match *kind {
+            // Span markers are only meaningful during MIR instrumentation,
+            // and have no effect during codegen.
+            CoverageKind::SpanMarker => {}
             CoverageKind::CounterIncrement { id } => {
                 func_coverage.mark_counter_id_seen(id);
                 // We need to explicitly drop the `RefMut` before calling into `instrprof_increment`,