about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir/coverage.rs
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2023-10-18 12:44:47 +1100
committerZalathar <Zalathar@users.noreply.github.com>2023-10-18 23:44:36 +1100
commit33da0978ac2674d046d3b01a9db33dc7f19339c6 (patch)
tree41dad3c88e0cd3a18155141acfd1736f73474c6d /compiler/rustc_middle/src/mir/coverage.rs
parent753caf292c10a172b45e749047221c31d35d76eb (diff)
downloadrust-33da0978ac2674d046d3b01a9db33dc7f19339c6.tar.gz
rust-33da0978ac2674d046d3b01a9db33dc7f19339c6.zip
coverage: Explicitly note that counter/expression IDs are function-local
Diffstat (limited to 'compiler/rustc_middle/src/mir/coverage.rs')
-rw-r--r--compiler/rustc_middle/src/mir/coverage.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/coverage.rs b/compiler/rustc_middle/src/mir/coverage.rs
index db578854fdc..08d377a8695 100644
--- a/compiler/rustc_middle/src/mir/coverage.rs
+++ b/compiler/rustc_middle/src/mir/coverage.rs
@@ -9,6 +9,11 @@ use std::fmt::{self, Debug, Formatter};
 rustc_index::newtype_index! {
     /// ID of a coverage counter. Values ascend from 0.
     ///
+    /// Before MIR inlining, counter IDs are local to their enclosing function.
+    /// After MIR inlining, coverage statements may have been inlined into
+    /// another function, so use the statement's source-scope to find which
+    /// function/instance its IDs are meaningful for.
+    ///
     /// Note that LLVM handles counter IDs as `uint32_t`, so there is no need
     /// to use a larger representation on the Rust side.
     #[derive(HashStable)]
@@ -24,6 +29,11 @@ impl CounterId {
 rustc_index::newtype_index! {
     /// ID of a coverage-counter expression. Values ascend from 0.
     ///
+    /// Before MIR inlining, expression IDs are local to their enclosing function.
+    /// After MIR inlining, coverage statements may have been inlined into
+    /// another function, so use the statement's source-scope to find which
+    /// function/instance its IDs are meaningful for.
+    ///
     /// Note that LLVM handles expression IDs as `uint32_t`, so there is no need
     /// to use a larger representation on the Rust side.
     #[derive(HashStable)]