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-10-06 22:46:04 +1100
committerZalathar <Zalathar@users.noreply.github.com>2023-10-22 20:11:48 +1100
commit86b55cccffa6f8c49747335a43abb04376d1e06f (patch)
treeda145892daaddacd5b9c7022c8a7f1756ca214b9 /compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
parent371883a05acf04be9fb8d3c0766990ba56cd22e3 (diff)
downloadrust-86b55cccffa6f8c49747335a43abb04376d1e06f.tar.gz
rust-86b55cccffa6f8c49747335a43abb04376d1e06f.zip
coverage: Fetch expressions and mappings separately
The combined `get_expressions_and_counter_regions` method was an artifact of
having to prepare the expressions and mappings at the same time, to avoid
ownership/lifetime problems with temporary data used by both.

Now that we have an explicit transition from `FunctionCoverageCollector` to the
final `FunctionCoverage`, we can prepare any shared data during that step and
store it in the final struct.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
index 5b2dae2c0a4..965be3f05ee 100644
--- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
+++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
@@ -185,13 +185,13 @@ fn encode_mappings_for_function(
     global_file_table: &mut GlobalFileTable,
     function_coverage: &FunctionCoverage<'_>,
 ) -> Vec<u8> {
-    let (expressions, counter_regions) = function_coverage.get_expressions_and_counter_regions();
-
-    let mut counter_regions = counter_regions.collect::<Vec<_>>();
+    let mut counter_regions = function_coverage.counter_regions().collect::<Vec<_>>();
     if counter_regions.is_empty() {
         return Vec::new();
     }
 
+    let expressions = function_coverage.counter_expressions().collect::<Vec<_>>();
+
     let mut virtual_file_mapping = IndexVec::<u32, u32>::new();
     let mut mapping_regions = Vec::with_capacity(counter_regions.len());