about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/transform/inline.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 /compiler/rustc_mir/src/transform/inline.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 'compiler/rustc_mir/src/transform/inline.rs')
-rw-r--r--compiler/rustc_mir/src/transform/inline.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_mir/src/transform/inline.rs b/compiler/rustc_mir/src/transform/inline.rs
index b6f80763bc8..f1c95a84ade 100644
--- a/compiler/rustc_mir/src/transform/inline.rs
+++ b/compiler/rustc_mir/src/transform/inline.rs
@@ -57,7 +57,7 @@ impl<'tcx> MirPass<'tcx> for Inline {
         if inline(tcx, body) {
             debug!("running simplify cfg on {:?}", body.source);
             CfgSimplifier::new(body).simplify();
-            remove_dead_blocks(body);
+            remove_dead_blocks(tcx, body);
         }
     }
 }