diff options
| author | Douglas Campos <qmx@qmx.me> | 2018-05-26 01:38:50 +0000 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2018-05-29 10:19:46 -0300 |
| commit | db39ec8f9acc5b1c597c6c3de4f3515c760ce06f (patch) | |
| tree | 4064d187dba300f84fa8775d904d8c0001e5ed9a | |
| parent | 2cd09f27b835d4342ce6f87eaf250eceb2718db8 (diff) | |
| download | rust-db39ec8f9acc5b1c597c6c3de4f3515c760ce06f.tar.gz rust-db39ec8f9acc5b1c597c6c3de4f3515c760ce06f.zip | |
store output in FlowState
| -rw-r--r-- | src/librustc_mir/borrow_check/flows.rs | 11 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/mod.rs | 9 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/librustc_mir/borrow_check/flows.rs b/src/librustc_mir/borrow_check/flows.rs index 070dc1d09bf..61915646d6f 100644 --- a/src/librustc_mir/borrow_check/flows.rs +++ b/src/librustc_mir/borrow_check/flows.rs @@ -14,8 +14,13 @@ //! but is not as ugly as it is right now. use rustc::mir::{BasicBlock, Location}; +use rustc::ty::RegionVid; use rustc_data_structures::indexed_set::Iter; +use borrow_check::location::LocationIndex; + +use polonius_engine::Output; + use dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces}; use dataflow::{EverInitializedPlaces, MovingOutStatements}; use dataflow::{Borrows}; @@ -23,6 +28,7 @@ use dataflow::{FlowAtLocation, FlowsAtLocation}; use dataflow::move_paths::HasMoveData; use dataflow::move_paths::indexes::BorrowIndex; use std::fmt; +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> { @@ -31,6 +37,9 @@ crate struct Flows<'b, 'gcx: 'tcx, 'tcx: 'b> { pub uninits: FlowAtLocation<MaybeUninitializedPlaces<'b, 'gcx, 'tcx>>, pub move_outs: FlowAtLocation<MovingOutStatements<'b, 'gcx, 'tcx>>, pub ever_inits: FlowAtLocation<EverInitializedPlaces<'b, 'gcx, 'tcx>>, + + /// Polonius Output + pub polonius_output: Option<Rc<Output<RegionVid, BorrowIndex, LocationIndex>>>, } impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> { @@ -40,6 +49,7 @@ impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> { uninits: FlowAtLocation<MaybeUninitializedPlaces<'b, 'gcx, 'tcx>>, move_outs: FlowAtLocation<MovingOutStatements<'b, 'gcx, 'tcx>>, ever_inits: FlowAtLocation<EverInitializedPlaces<'b, 'gcx, 'tcx>>, + polonius_output: Option<Rc<Output<RegionVid, BorrowIndex, LocationIndex>>>, ) -> Self { Flows { borrows, @@ -47,6 +57,7 @@ impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> { uninits, move_outs, ever_inits, + polonius_output, } } diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index e2d696e9b0f..983a2ac2ec1 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -11,12 +11,11 @@ //! This query borrow-checks the MIR to (further) ensure it is not broken. use borrow_check::nll::region_infer::RegionInferenceContext; -use borrow_check::location::LocationIndex; use rustc::hir; use rustc::hir::def_id::DefId; use rustc::hir::map::definitions::DefPathData; use rustc::infer::InferCtxt; -use rustc::ty::{self, ParamEnv, RegionVid, TyCtxt}; +use rustc::ty::{self, ParamEnv, TyCtxt}; use rustc::ty::maps::Providers; use rustc::lint::builtin::UNUSED_MUT; use rustc::mir::{AggregateKind, BasicBlock, BorrowCheckResult, BorrowKind}; @@ -46,7 +45,6 @@ use dataflow::move_paths::{IllegalMoveOriginKind, MoveError}; use dataflow::move_paths::{HasMoveData, LookupResult, MoveData, MovePathIndex}; use util::borrowck_errors::{BorrowckErrors, Origin}; use util::collect_writes::FindAssignments; -use polonius_engine::Output; use self::borrow_set::{BorrowSet, BorrowData}; use self::flows::Flows; @@ -253,7 +251,6 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( used_mut_upvars: SmallVec::new(), borrow_set, dominators, - polonius_output, }; let mut state = Flows::new( @@ -262,6 +259,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( flow_uninits, flow_move_outs, flow_ever_inits, + polonius_output, ); mbcx.analyze_results(&mut state); // entry point for DataflowResultsConsumer @@ -376,9 +374,6 @@ pub struct MirBorrowckCtxt<'cx, 'gcx: 'tcx, 'tcx: 'cx> { /// Dominators for MIR dominators: Dominators<BasicBlock>, - - /// Polonius Output - polonius_output: Option<Rc<Output<RegionVid, BorrowIndex, LocationIndex>>>, } // Check that: |
