about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-10-31 21:12:15 +1100
committerZalathar <Zalathar@users.noreply.github.com>2024-10-31 21:25:43 +1100
commit8dddd1ae603756ef4957320880115ecc65d706a5 (patch)
treee265140dee433a311c102917f34d330e938a125e /compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
parent75eff9a5749411ba5a0b37cc3299116c4e263075 (diff)
downloadrust-8dddd1ae603756ef4957320880115ecc65d706a5.tar.gz
rust-8dddd1ae603756ef4957320880115ecc65d706a5.zip
coverage: Avoid ICE when `coverage_cx` is unexpectedly unavailable
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
index a298ed86276..e4ff50816b9 100644
--- a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
+++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs
@@ -152,7 +152,12 @@ impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
             return;
         };
 
-        let mut coverage_map = bx.coverage_cx().function_coverage_map.borrow_mut();
+        // FIXME(#132395): Unwrapping `coverage_cx` here has led to ICEs in the
+        // wild, so keep this early-return until we understand why.
+        let mut coverage_map = match bx.coverage_cx {
+            Some(ref cx) => cx.function_coverage_map.borrow_mut(),
+            None => return,
+        };
         let func_coverage = coverage_map
             .entry(instance)
             .or_insert_with(|| FunctionCoverageCollector::new(instance, function_coverage_info));