Don't clone symbol names for coverage hashing
A symbol already contains a `&str`, and in this context there's no need to make an owned copy, so we can just use the original string reference.
This commit is contained in:
parent
33a2c2487a
commit
29c53d8748
1 changed files with 3 additions and 3 deletions
|
@ -63,7 +63,7 @@ pub fn finalize(cx: &CodegenCx<'_, '_>) {
|
|||
let mut function_data = Vec::new();
|
||||
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).to_string();
|
||||
let mangled_function_name = tcx.symbol_name(instance).name;
|
||||
let source_hash = function_coverage.source_hash();
|
||||
let is_used = function_coverage.is_used();
|
||||
let (expressions, counter_regions) =
|
||||
|
@ -228,7 +228,7 @@ impl CoverageMapGenerator {
|
|||
/// specific, well-known section and name.
|
||||
fn save_function_record(
|
||||
cx: &CodegenCx<'_, '_>,
|
||||
mangled_function_name: String,
|
||||
mangled_function_name: &str,
|
||||
source_hash: u64,
|
||||
filenames_ref: u64,
|
||||
coverage_mapping_buffer: Vec<u8>,
|
||||
|
@ -238,7 +238,7 @@ fn save_function_record(
|
|||
let coverage_mapping_size = coverage_mapping_buffer.len();
|
||||
let coverage_mapping_val = cx.const_bytes(&coverage_mapping_buffer);
|
||||
|
||||
let func_name_hash = coverageinfo::hash_str(&mangled_function_name);
|
||||
let func_name_hash = coverageinfo::hash_str(mangled_function_name);
|
||||
let func_name_hash_val = cx.const_u64(func_name_hash);
|
||||
let coverage_mapping_size_val = cx.const_u32(coverage_mapping_size as u32);
|
||||
let source_hash_val = cx.const_u64(source_hash);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue