about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-12-10 10:25:38 +0000
committerbors <bors@rust-lang.org>2024-12-10 10:25:38 +0000
commit499605271718bceaa629f0b954502c0040e4456b (patch)
treeb51977c7b9a0fe8cf76191f4e2ef1c71917bd510 /compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
parentb597d2a099a1b5b79acef05175a9ac847047f8a1 (diff)
parent8434a6e2bbb3c4855f24e1a86de960dca26cadf9 (diff)
downloadrust-499605271718bceaa629f0b954502c0040e4456b.tar.gz
rust-499605271718bceaa629f0b954502c0040e4456b.zip
Auto merge of #134108 - fmease:rollup-tbtwm6j, r=fmease
Rollup of 10 pull requests

Successful merges:

 - #131558 (Lint on combining `#[no_mangle]` and `#[export_name]`)
 - #133184 (wasi/fs: Improve stopping condition for <ReadDir as Iterator>::next)
 - #133456 (Add licenses + Run `cargo update`)
 - #133472 (Run TLS destructors for wasm32-wasip1-threads)
 - #133853 (use vendor sources by default on dist tarballs)
 - #133946 (coverage: Prefer to visit nodes whose predecessors have been visited)
 - #134010 (fix ICE on type error in promoted)
 - #134029 (coverage: Use a query to find counters/expressions that must be zero)
 - #134071 (Configure renovatebot)
 - #134102 (Miscellaneous fixes for nix-dev-shell)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs20
1 files changed, 5 insertions, 15 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
index 8c24579fa7c..a6c3caf9e2b 100644
--- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
+++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
@@ -20,7 +20,7 @@ use rustc_target::spec::HasTargetSpec;
 use tracing::debug;
 
 use crate::common::CodegenCx;
-use crate::coverageinfo::map_data::{FunctionCoverage, FunctionCoverageCollector};
+use crate::coverageinfo::map_data::FunctionCoverage;
 use crate::coverageinfo::{ffi, llvm_cov};
 use crate::llvm;
 
@@ -63,16 +63,11 @@ pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) {
         None => return,
     };
     if function_coverage_map.is_empty() {
-        // This module has no functions with coverage instrumentation
+        // This CGU has no functions with coverage instrumentation.
         return;
     }
 
-    let function_coverage_entries = function_coverage_map
-        .into_iter()
-        .map(|(instance, function_coverage)| (instance, function_coverage.into_finished()))
-        .collect::<Vec<_>>();
-
-    let all_file_names = function_coverage_entries
+    let all_file_names = function_coverage_map
         .iter()
         .map(|(_, fn_cov)| fn_cov.function_coverage_info.body_span)
         .map(|span| span_file_name(tcx, span));
@@ -92,7 +87,7 @@ pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) {
     let mut unused_function_names = Vec::new();
 
     // Encode coverage mappings and generate function records
-    for (instance, function_coverage) in function_coverage_entries {
+    for (instance, function_coverage) in function_coverage_map {
         debug!("Generate function coverage for {}, {:?}", cx.codegen_unit.name(), instance);
 
         let mangled_function_name = tcx.symbol_name(instance).name;
@@ -536,11 +531,6 @@ fn add_unused_function_coverage<'tcx>(
     );
 
     // An unused function's mappings will all be rewritten to map to zero.
-    let function_coverage = FunctionCoverageCollector::unused(
-        instance,
-        function_coverage_info,
-        tcx.coverage_ids_info(instance.def),
-    );
-
+    let function_coverage = FunctionCoverage::new_unused(function_coverage_info);
     cx.coverage_cx().function_coverage_map.borrow_mut().insert(instance, function_coverage);
 }