about summary refs log tree commit diff
path: root/compiler/rustc_interface/src/tests.rs
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-05-19 21:10:42 +1000
committerGitHub <noreply@github.com>2025-05-19 21:10:42 +1000
commit3b22c21dd8c30f499051fe7a758ca0e5d81eb638 (patch)
tree6c13ac74a4c786ce93769c16e73c0c95adaba7ef /compiler/rustc_interface/src/tests.rs
parent5f292eea6d63abbd26f1e6e00a0b8cf21d828d7d (diff)
parent078144fdfa7ae627d43cd919d660a71bef1e4658 (diff)
downloadrust-3b22c21dd8c30f499051fe7a758ca0e5d81eb638.tar.gz
rust-3b22c21dd8c30f499051fe7a758ca0e5d81eb638.zip
Rollup merge of #140847 - Zalathar:unused-local-file, r=SparrowLii
coverage: Detect unused local file IDs to avoid an LLVM assertion

Each function's coverage metadata contains a *local file table* that maps local file IDs (used by the function's mapping regions) to global file IDs (shared by all functions in the same CGU).

LLVM requires all local file IDs to have at least one mapping region, and has an assertion that will fail if it detects a local file ID with no regions. To make sure that assertion doesn't fire, we need to detect and skip functions whose metadata would trigger it.

(This can't actually happen yet, because currently all of a function's spans must belong to the same file and expansion. But this will be an important edge case when adding expansion region support.)
Diffstat (limited to 'compiler/rustc_interface/src/tests.rs')
-rw-r--r--compiler/rustc_interface/src/tests.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs
index 068d96c860f..20e081d3360 100644
--- a/compiler/rustc_interface/src/tests.rs
+++ b/compiler/rustc_interface/src/tests.rs
@@ -776,7 +776,8 @@ fn test_unstable_options_tracking_hash() {
         CoverageOptions {
             level: CoverageLevel::Mcdc,
             no_mir_spans: true,
-            discard_all_spans_in_codegen: true
+            discard_all_spans_in_codegen: true,
+            inject_unused_local_file: true,
         }
     );
     tracked!(crate_attr, vec!["abc".to_string()]);