diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2025-08-02 22:17:14 +1000 | 
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2025-08-04 11:55:25 +1000 | 
| commit | 33706fc17f858caf42d36a9f67ef794269b6a83f (patch) | |
| tree | d2d5a80d287eeba09ec04e36a17048f7888ee582 /compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs | |
| parent | 383b9c447b61641e1f1a3850253944a897a60827 (diff) | |
| download | rust-33706fc17f858caf42d36a9f67ef794269b6a83f.tar.gz rust-33706fc17f858caf42d36a9f67ef794269b6a83f.zip | |
coverage: Include an `Instance` in `CovfunRecord` for debug messages
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs | 7 | 
1 files changed, 6 insertions, 1 deletions
| diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs index b704cf2b1cd..44b6eb0e689 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs @@ -27,6 +27,9 @@ use crate::llvm; /// the final record that will be embedded in the `__llvm_covfun` section. #[derive(Debug)] pub(crate) struct CovfunRecord<'tcx> { + /// Not used directly, but helpful in debug messages. + _instance: Instance<'tcx>, + mangled_function_name: &'tcx str, source_hash: u64, is_used: bool, @@ -55,6 +58,7 @@ pub(crate) fn prepare_covfun_record<'tcx>( let expressions = prepare_expressions(ids_info); let mut covfun = CovfunRecord { + _instance: instance, mangled_function_name: tcx.symbol_name(instance).name, source_hash: if is_used { fn_cov_info.function_source_hash } else { 0 }, is_used, @@ -106,7 +110,7 @@ fn fill_region_tables<'tcx>( // first mapping's span to determine the file. let source_map = tcx.sess.source_map(); let Some(first_span) = (try { fn_cov_info.mappings.first()?.span }) else { - debug_assert!(false, "function has no mappings: {:?}", covfun.mangled_function_name); + debug_assert!(false, "function has no mappings: {covfun:?}"); return; }; let source_file = source_map.lookup_source_file(first_span.lo()); @@ -184,6 +188,7 @@ pub(crate) fn generate_covfun_record<'tcx>( covfun: &CovfunRecord<'tcx>, ) { let &CovfunRecord { + _instance, mangled_function_name, source_hash, is_used, | 
