Skip to content

Commit ff7f6d5

Browse files
committed
don't walk MIR if no local variables need liveness
This is true for tuple-stress and html5ever
1 parent 1bae4f5 commit ff7f6d5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs

+5
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ impl NllLivenessMap {
8686
to_local,
8787
}
8888
}
89+
90+
/// True if there are no local variables that need liveness computation.
91+
crate fn is_empty(&self) -> bool {
92+
self.to_local.is_empty()
93+
}
8994
}
9095

9196
/// Index given to each local variable whose type contains a region.

src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub(super) fn generate<'gcx, 'tcx>(
5555
let liveness = LivenessResults::compute(mir, &liveness_map);
5656

5757
// For everything else, it is only live where it is actually used.
58-
{
58+
if !liveness_map.is_empty() {
5959
let mut generator = TypeLivenessGenerator {
6060
cx,
6161
mir,

0 commit comments

Comments
 (0)