diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2025-03-18 21:19:08 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2025-03-18 23:18:24 +1100 |
| commit | cc8336b6c1c5400cf85521218afda47dbbbe782c (patch) | |
| tree | 6debf1ced9c6d8c43b2aaba3d9627506b33b69e0 /compiler/rustc_codegen_llvm/src/coverageinfo | |
| parent | cd2b9784333496c3af125393111eb6cdd158f134 (diff) | |
| download | rust-cc8336b6c1c5400cf85521218afda47dbbbe782c.tar.gz rust-cc8336b6c1c5400cf85521218afda47dbbbe782c.zip | |
coverage: Don't store a body span in `FunctionCoverageInfo`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs index 7592d865cf1..5b487bc1a8b 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs @@ -105,9 +105,14 @@ fn fill_region_tables<'tcx>( ids_info: &'tcx CoverageIdsInfo, covfun: &mut CovfunRecord<'tcx>, ) { - // Currently a function's mappings must all be in the same file as its body span. + // Currently a function's mappings must all be in the same file, so use the + // first mapping's span to determine the file. let source_map = tcx.sess.source_map(); - let source_file = source_map.lookup_source_file(fn_cov_info.body_span.lo()); + let Some(first_span) = (try { fn_cov_info.mappings.first()?.span }) else { + debug_assert!(false, "function has no mappings: {:?}", covfun.mangled_function_name); + return; + }; + let source_file = source_map.lookup_source_file(first_span.lo()); // Look up the global file ID for that file. let global_file_id = global_file_table.global_file_id_for_file(&source_file); |
