Skip to content

Commit 33706fc

Browse files
committed
coverage: Include an Instance in CovfunRecord for debug messages
1 parent 383b9c4 commit 33706fc

File tree

1 file changed

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

1 file changed

+6
-1
lines changed

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ use crate::llvm;
2727
/// the final record that will be embedded in the `__llvm_covfun` section.
2828
#[derive(Debug)]
2929
pub(crate) struct CovfunRecord<'tcx> {
30+
/// Not used directly, but helpful in debug messages.
31+
_instance: Instance<'tcx>,
32+
3033
mangled_function_name: &'tcx str,
3134
source_hash: u64,
3235
is_used: bool,
@@ -55,6 +58,7 @@ pub(crate) fn prepare_covfun_record<'tcx>(
5558
let expressions = prepare_expressions(ids_info);
5659

5760
let mut covfun = CovfunRecord {
61+
_instance: instance,
5862
mangled_function_name: tcx.symbol_name(instance).name,
5963
source_hash: if is_used { fn_cov_info.function_source_hash } else { 0 },
6064
is_used,
@@ -106,7 +110,7 @@ fn fill_region_tables<'tcx>(
106110
// first mapping's span to determine the file.
107111
let source_map = tcx.sess.source_map();
108112
let Some(first_span) = (try { fn_cov_info.mappings.first()?.span }) else {
109-
debug_assert!(false, "function has no mappings: {:?}", covfun.mangled_function_name);
113+
debug_assert!(false, "function has no mappings: {covfun:?}");
110114
return;
111115
};
112116
let source_file = source_map.lookup_source_file(first_span.lo());
@@ -184,6 +188,7 @@ pub(crate) fn generate_covfun_record<'tcx>(
184188
covfun: &CovfunRecord<'tcx>,
185189
) {
186190
let &CovfunRecord {
191+
_instance,
187192
mangled_function_name,
188193
source_hash,
189194
is_used,

0 commit comments

Comments
 (0)