1
Fork 0

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.
This commit is contained in:
Zalathar 2023-11-23 12:50:40 +11:00
parent 98166358a9
commit d90fd027c8
5 changed files with 17 additions and 12 deletions

View file

@ -32,7 +32,7 @@
^0
LL| |
LL| | if
LL| | !
LL| 1| !
LL| 1| is_true
LL| 0| {
LL| 0| a = 2