about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2023-09-13 12:51:43 +1000
committerZalathar <Zalathar@users.noreply.github.com>2023-10-18 23:42:39 +1100
commit6da319f63583215d593919bcd994785141f7265d (patch)
tree62c2164390bf0f15a16a19ee5731aa53ffe17044 /compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
parent4099ab19979e2f22b7a949f83241f4f0adc00ca9 (diff)
downloadrust-6da319f63583215d593919bcd994785141f7265d.tar.gz
rust-6da319f63583215d593919bcd994785141f7265d.zip
coverage: Store all of a function's mappings in function coverage info
Previously, mappings were attached to individual coverage statements in MIR.
That necessitated special handling in MIR optimizations to avoid deleting those
statements, since otherwise codegen would be unable to reassemble the original
list of mappings.

With this change, a function's list of mappings is now attached to its MIR
body, and survives intact even if individual statements are deleted by
optimizations.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
index cde12b13307..ef3647efd88 100644
--- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
+++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
@@ -59,10 +59,8 @@ pub fn finalize(cx: &CodegenCx<'_, '_>) {
 
     // Encode coverage mappings and generate function records
     let mut function_data = Vec::new();
-    for (instance, mut function_coverage) in function_coverage_map {
+    for (instance, function_coverage) in function_coverage_map {
         debug!("Generate function coverage for {}, {:?}", cx.codegen_unit.name(), instance);
-        function_coverage.finalize();
-        let function_coverage = function_coverage;
 
         let mangled_function_name = tcx.symbol_name(instance).name;
         let source_hash = function_coverage.source_hash();