Skip to content

Commit 1cca252

Browse files
committed
coverage: Re-enable UnreachablePropagation for coverage builds
1 parent 54116c8 commit 1cca252

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

compiler/rustc_mir_transform/src/unreachable_prop.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ pub struct UnreachablePropagation;
1414
impl MirPass<'_> for UnreachablePropagation {
1515
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
1616
// Enable only under -Zmir-opt-level=2 as this can make programs less debuggable.
17-
18-
// FIXME(#116171) Coverage gets confused by MIR passes that can remove all
19-
// coverage statements from an instrumented function. This pass can be
20-
// re-enabled when coverage codegen is robust against that happening.
21-
sess.mir_opt_level() >= 2 && !sess.instrument_coverage()
17+
sess.mir_opt_level() >= 2
2218
}
2319

2420
fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {

tests/coverage/unreachable.cov-map

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ Number of expressions: 0
1414
Number of file 0 mappings: 1
1515
- Code(Counter(0)) at (prev + 17, 1) to (start + 1, 37)
1616

17-
Function name: unreachable::unreachable_intrinsic
18-
Raw bytes (9): 0x[01, 01, 00, 01, 01, 16, 01, 01, 2c]
17+
Function name: unreachable::unreachable_intrinsic (unused)
18+
Raw bytes (9): 0x[01, 01, 00, 01, 00, 16, 01, 01, 2c]
1919
Number of files: 1
2020
- file 0 => global file 1
2121
Number of expressions: 0
2222
Number of file 0 mappings: 1
23-
- Code(Counter(0)) at (prev + 22, 1) to (start + 1, 44)
23+
- Code(Zero) at (prev + 22, 1) to (start + 1, 44)
2424

0 commit comments

Comments
 (0)