From 1d912bfb422b187d929a2bc3542556a78b19257d Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Sun, 22 Jul 2018 11:02:59 +0100 Subject: [PATCH] Don't keep the possibly init flow around longer than needed --- src/librustc_mir/borrow_check/flows.rs | 18 +----------------- src/librustc_mir/borrow_check/mod.rs | 2 -- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/librustc_mir/borrow_check/flows.rs b/src/librustc_mir/borrow_check/flows.rs index 5631356dc1e90..6dfcece3071c9 100644 --- a/src/librustc_mir/borrow_check/flows.rs +++ b/src/librustc_mir/borrow_check/flows.rs @@ -26,7 +26,7 @@ use dataflow::move_paths::HasMoveData; use dataflow::Borrows; use dataflow::{EverInitializedPlaces, MovingOutStatements}; use dataflow::{FlowAtLocation, FlowsAtLocation}; -use dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces}; +use dataflow::MaybeUninitializedPlaces; use either::Either; use std::fmt; use std::rc::Rc; @@ -34,7 +34,6 @@ use std::rc::Rc; // (forced to be `pub` due to its use as an associated type below.) crate struct Flows<'b, 'gcx: 'tcx, 'tcx: 'b> { borrows: FlowAtLocation>, - pub inits: FlowAtLocation>, pub uninits: FlowAtLocation>, pub move_outs: FlowAtLocation>, pub ever_inits: FlowAtLocation>, @@ -46,7 +45,6 @@ crate struct Flows<'b, 'gcx: 'tcx, 'tcx: 'b> { impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> { crate fn new( borrows: FlowAtLocation>, - inits: FlowAtLocation>, uninits: FlowAtLocation>, move_outs: FlowAtLocation>, ever_inits: FlowAtLocation>, @@ -54,7 +52,6 @@ impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> { ) -> Self { Flows { borrows, - inits, uninits, move_outs, ever_inits, @@ -81,7 +78,6 @@ impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> { macro_rules! each_flow { ($this:ident, $meth:ident($arg:ident)) => { FlowAtLocation::$meth(&mut $this.borrows, $arg); - FlowAtLocation::$meth(&mut $this.inits, $arg); FlowAtLocation::$meth(&mut $this.uninits, $arg); FlowAtLocation::$meth(&mut $this.move_outs, $arg); FlowAtLocation::$meth(&mut $this.ever_inits, $arg); @@ -134,18 +130,6 @@ impl<'b, 'gcx, 'tcx> fmt::Display for Flows<'b, 'gcx, 'tcx> { }); s.push_str("] "); - s.push_str("inits: ["); - let mut saw_one = false; - self.inits.each_state_bit(|mpi_init| { - if saw_one { - s.push_str(", "); - }; - saw_one = true; - let move_path = &self.inits.operator().move_data().move_paths[mpi_init]; - s.push_str(&format!("{}", move_path)); - }); - s.push_str("] "); - s.push_str("uninits: ["); let mut saw_one = false; self.uninits.each_state_bit(|mpi_uninit| { diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index c212c1b826bd9..738f46da9ee3b 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -218,7 +218,6 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( &borrow_set, ); let regioncx = Rc::new(regioncx); - let flow_inits = flow_inits; // remove mut let flow_borrows = FlowAtLocation::new(do_dataflow( tcx, @@ -264,7 +263,6 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( let mut state = Flows::new( flow_borrows, - flow_inits, flow_uninits, flow_move_outs, flow_ever_inits,