summary refs log tree commit diff
path: root/tests/coverage/if_not.coverage
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2023-11-23 12:50:40 +1100
committerZalathar <Zalathar@users.noreply.github.com>2023-12-08 22:40:49 +1100
commitd90fd027c887247caa501db5f49352fdfab769d9 (patch)
tree07969117a9a6ae2fe624a8692ba261f195459ff9 /tests/coverage/if_not.coverage
parent98166358a99aea4ded1a42a3c113aac764c752ed (diff)
downloadrust-d90fd027c887247caa501db5f49352fdfab769d9.tar.gz
rust-d90fd027c887247caa501db5f49352fdfab769d9.zip
coverage: Use `SpanMarker` to mark the full condition of `if !`
When MIR is built for an if-not expression, the `!` part of the condition
doesn't correspond to any MIR statement, so coverage instrumentation normally
can't see it.

We can fix that by deliberately injecting a dummy statement whose sole purpose
is to associate that span with its enclosing block.
Diffstat (limited to 'tests/coverage/if_not.coverage')
-rw-r--r--tests/coverage/if_not.coverage4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/coverage/if_not.coverage b/tests/coverage/if_not.coverage
index 4c8ef9a84e2..41838b8513f 100644
--- a/tests/coverage/if_not.coverage
+++ b/tests/coverage/if_not.coverage
@@ -10,14 +10,14 @@
    LL|      8|    }
    LL|       |
    LL|       |    if
-   LL|       |        !
+   LL|     12|        !
    LL|     12|        cond
    LL|      4|    {
    LL|      4|        println!("cond was false");
    LL|      8|    }
    LL|       |
    LL|       |    if
-   LL|       |        !
+   LL|     12|        !
    LL|     12|        cond
    LL|      4|    {
    LL|      4|        println!("cond was false");