coverage: Make fn_sig_span optional, and note its quirks

This commit is contained in:
Zalathar
2024-01-22 17:04:13 +11:00
parent fde1702db8
commit a246b6be1d
3 changed files with 17 additions and 11 deletions

View File

@@ -51,8 +51,9 @@ pub(super) fn generate_coverage_spans(
// with the user code wrapped in a closure. Any spans in the desugared
// outer function will be unhelpful, so just keep the signature span
// and ignore all of the spans in the MIR body.
let span = hir_info.fn_sig_span;
mappings.push(BcbMapping { kind: BcbMappingKind::Code(START_BCB), span });
if let Some(span) = hir_info.fn_sig_span_extended {
mappings.push(BcbMapping { kind: BcbMappingKind::Code(START_BCB), span });
}
} else {
let sorted_spans = from_mir::mir_to_initial_sorted_coverage_spans(
mir_body,