about summary refs log tree commit diff
path: root/src/test/run-make-fulldeps/coverage/conditions.rs
diff options
context:
space:
mode:
authorRich Kadel <richkadel@google.com>2021-05-01 14:56:48 -0700
committerRich Kadel <richkadel@google.com>2021-05-01 15:04:48 -0700
commit0b0d293c7c46bdadf80e5304a667e34c53c0cf7e (patch)
tree7a2fac5f5697d60eef39f20242a51e4582ca00f6 /src/test/run-make-fulldeps/coverage/conditions.rs
parent603a42ec5458c547b51173cfa48c23ad37b03c3f (diff)
downloadrust-0b0d293c7c46bdadf80e5304a667e34c53c0cf7e.tar.gz
rust-0b0d293c7c46bdadf80e5304a667e34c53c0cf7e.zip
Report coverage `0` of dead blocks
Fixes: #84018

With `-Z instrument-coverage`, coverage reporting of dead blocks
(for example, blocks dropped because a conditional branch is dropped,
based on const evaluation) is now supported.

If `instrument-coverage` is enabled, `simplify::remove_dead_blocks()`
finds all dropped coverage `Statement`s and adds their `code_region`s as
`Unreachable` coverage `Statement`s to the `START_BLOCK`, so they are
still included in the coverage map.

Check out the resulting changes in the test coverage reports in this PR.
Diffstat (limited to 'src/test/run-make-fulldeps/coverage/conditions.rs')
-rw-r--r--src/test/run-make-fulldeps/coverage/conditions.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/run-make-fulldeps/coverage/conditions.rs b/src/test/run-make-fulldeps/coverage/conditions.rs
index 8a2a0b53e58..057599d1b47 100644
--- a/src/test/run-make-fulldeps/coverage/conditions.rs
+++ b/src/test/run-make-fulldeps/coverage/conditions.rs
@@ -53,8 +53,8 @@ fn main() {
         } else {
             return;
         }
-    } // Note: closing brace shows uncovered (vs. `0` for implicit else) because condition literal
-      // `true` was const-evaluated. The compiler knows the `if` block will be executed.
+    }
+
 
     let mut countdown = 0;
     if true {