Skip to content

Commit 5808006

Browse files
committed
coverage: Pre-allocate enough capacity for all of a function's mapping regions
1 parent 4f73cd1 commit 5808006

File tree

1 file changed

+1
-1
lines changed
  • compiler/rustc_codegen_llvm/src/coverageinfo

1 file changed

+1
-1
lines changed

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ fn encode_mappings_for_function<'a>(
166166
}
167167

168168
let mut virtual_file_mapping = Vec::new();
169-
let mut mapping_regions = Vec::new();
169+
let mut mapping_regions = Vec::with_capacity(counter_regions.len());
170170

171171
// Convert the list of (Counter, CodeRegion) pairs to an array of `CounterMappingRegion`, sorted
172172
// by filename and position. Capture any new files to compute the `CounterMappingRegion`s

0 commit comments

Comments
 (0)