diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-10-31 21:12:15 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-10-31 21:25:43 +1100 |
| commit | 8dddd1ae603756ef4957320880115ecc65d706a5 (patch) | |
| tree | e265140dee433a311c102917f34d330e938a125e /compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs | |
| parent | 75eff9a5749411ba5a0b37cc3299116c4e263075 (diff) | |
| download | rust-8dddd1ae603756ef4957320880115ecc65d706a5.tar.gz rust-8dddd1ae603756ef4957320880115ecc65d706a5.zip | |
coverage: Avoid ICE when `coverage_cx` is unexpectedly unavailable
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs index 8edd788ee36..f6378199fe2 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs @@ -54,7 +54,11 @@ pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) { add_unused_functions(cx); } - let function_coverage_map = cx.coverage_cx().take_function_coverage_map(); + // FIXME(#132395): Can this be none even when coverage is enabled? + let function_coverage_map = match cx.coverage_cx { + Some(ref cx) => cx.take_function_coverage_map(), + None => return, + }; if function_coverage_map.is_empty() { // This module has no functions with coverage instrumentation return; |
