From f1c92476634485c6a2fb17d33046cedddaa150a2 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 6 Jun 2018 17:31:22 +0200 Subject: [PATCH] NLL performance boost --- .../borrow_check/nll/type_check/liveness.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness.rs index d19fd2bb5969d..76320c6a2eacc 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness.rs @@ -104,13 +104,15 @@ impl<'gen, 'typeck, 'flow, 'gcx, 'tcx> TypeLivenessGenerator<'gen, 'typeck, 'flo location, live_local ); - self.flow_inits.each_state_bit(|mpi_init| { - debug!( - "add_liveness_constraints: location={:?} initialized={:?}", - location, - &self.flow_inits.operator().move_data().move_paths[mpi_init] - ); - }); + if log_enabled!(::log::Level::Debug) { + self.flow_inits.each_state_bit(|mpi_init| { + debug!( + "add_liveness_constraints: location={:?} initialized={:?}", + location, + &self.flow_inits.operator().move_data().move_paths[mpi_init] + ); + }); + } let mpi = self.move_data.rev_lookup.find_local(live_local); if let Some(initialized_child) = self.flow_inits.has_any_child_of(mpi) {