about summary refs log tree commit diff
path: root/tests/coverage/no_spans.coverage
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2025-04-12 17:52:55 +1000
committerZalathar <Zalathar@users.noreply.github.com>2025-05-06 20:42:25 +1000
commit4d5a1acebfe031ca2af75786295a2cd2a0633943 (patch)
treea0b54774a87c3b03b526566969c395a0dd4add2c /tests/coverage/no_spans.coverage
parent651e9cf327358b28db7e37a2ae61727f4a2ef232 (diff)
coverage: Only merge adjacent coverage spans
This also removes some manipulation of the function signature span that only
made sense in the context of merging non-adjacent spans.
Diffstat (limited to 'tests/coverage/no_spans.coverage')
-rw-r--r--tests/coverage/no_spans.coverage21
1 files changed, 8 insertions, 13 deletions
diff --git a/tests/coverage/no_spans.coverage b/tests/coverage/no_spans.coverage
index 19e8c2fe5b6..cf0e47677e9 100644
--- a/tests/coverage/no_spans.coverage
+++ b/tests/coverage/no_spans.coverage
@@ -1,20 +1,15 @@
    LL|       |#![feature(coverage_attribute)]
    LL|       |//@ edition: 2021
    LL|       |
-   LL|       |// If the span extractor can't find any relevant spans for a function, the
-   LL|       |// refinement loop will terminate with nothing in its `prev` slot. If the
-   LL|       |// subsequent code tries to unwrap `prev`, it will panic.
+   LL|       |// Test that coverage instrumentation can gracefully handle functions that end
+   LL|       |// up having no relevant spans, without crashing the compiler or causing
+   LL|       |// `llvm-cov` to fail.
    LL|       |//
-   LL|       |// This scenario became more likely after #118525 started discarding spans that
-   LL|       |// can't be un-expanded back to within the function body.
-   LL|       |//
-   LL|       |// Regression test for "invalid attempt to unwrap a None some_prev", as seen
-   LL|       |// in issues such as #118643 and #118662.
+   LL|       |// This was originally a regression test for issues such as #118643 and #118662.
    LL|       |
-   LL|       |#[coverage(off)]
-   LL|       |fn main() {
-   LL|       |    affected_function()();
-   LL|       |}
+   LL|      1|fn main() {
+   LL|      1|    affected_function()();
+   LL|      1|}
    LL|       |
    LL|       |macro_rules! macro_that_defines_a_function {
    LL|       |    (fn $name:ident () $body:tt) => {
@@ -24,7 +19,7 @@
    LL|       |
    LL|       |macro_that_defines_a_function! {
    LL|      1|    fn affected_function() {
-   LL|      1|        || ()
+   LL|       |        || ()
    LL|       |    }
    LL|       |}