rust/compiler/rustc_mir_transform/src/coverage
Matthias Krüger e9df0b6b40
Rollup merge of #116974 - Zalathar:signature-spans, r=oli-obk,cjgillot
coverage: Fix inconsistent handling of function signature spans

While doing some more cleanup of `spans`, I noticed a strange inconsistency in how function signatures are handled. Normally the function signature span is treated as though it were executable as part of the start of the function, but in some cases the signature span disappears entirely from coverage, for no obvious reason.

This is caused by the fact that spans created by `CoverageSpan::for_fn_sig` don't add the span to their `merged_spans` field (unlike normal statement/terminator spans). In cases where the span-processing code looks at those merged spans, it thinks the signature span is no longer visible and deletes it.

Adding the signature span to `merged_spans` resolves the inconsistency.

(Prior to #116409 this wouldn't have been possible, because there was no case in the old `CoverageStatement` enum representing a signature. Now that `merged_spans` is just a list of spans, that's no longer an obstacle.)
2023-10-21 10:08:17 +02:00
..
spans coverage: Simplify initial creation of coverage spans 2023-10-21 11:56:15 +11:00
test_macros inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
counters.rs coverage: Simplify the injection of coverage statements 2023-10-21 12:33:33 +11:00
graph.rs s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
mod.rs coverage: Simplify the injection of coverage statements 2023-10-21 12:33:33 +11:00
query.rs coverage: Store all of a function's mappings in function coverage info 2023-10-18 23:42:39 +11:00
spans.rs Rollup merge of #116974 - Zalathar:signature-spans, r=oli-obk,cjgillot 2023-10-21 10:08:17 +02:00
tests.rs coverage: Store expression data in function coverage info 2023-10-18 23:44:34 +11:00