about summary refs log tree commit diff
path: root/compiler/rustc_session/src/session.rs
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2025-05-09 20:57:17 +1000
committerZalathar <Zalathar@users.noreply.github.com>2025-05-10 00:24:03 +1000
commit078144fdfa7ae627d43cd919d660a71bef1e4658 (patch)
tree8188e89378f1b0055d8d572cd8a037bb0f74e5e2 /compiler/rustc_session/src/session.rs
parent8cd8b23b9e4b1f05373831644b005b21a13a9c69 (diff)
downloadrust-078144fdfa7ae627d43cd919d660a71bef1e4658.tar.gz
rust-078144fdfa7ae627d43cd919d660a71bef1e4658.zip
coverage: Detect unused local file IDs to avoid an LLVM assertion
This case can't actually happen yet (other than via a testing flag), 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_session/src/session.rs')
-rw-r--r--compiler/rustc_session/src/session.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs
index 010ae42c280..34ac37d6378 100644
--- a/compiler/rustc_session/src/session.rs
+++ b/compiler/rustc_session/src/session.rs
@@ -371,6 +371,11 @@ impl Session {
         self.opts.unstable_opts.coverage_options.discard_all_spans_in_codegen
     }
 
+    /// True if testing flag `-Zcoverage-options=inject-unused-local-file` was passed.
+    pub fn coverage_inject_unused_local_file(&self) -> bool {
+        self.opts.unstable_opts.coverage_options.inject_unused_local_file
+    }
+
     pub fn is_sanitizer_cfi_enabled(&self) -> bool {
         self.opts.unstable_opts.sanitizer.contains(SanitizerSet::CFI)
     }