store polonius output in MirBorrowCtx

This commit is contained in:
Douglas Campos 2018-05-26 01:14:45 +00:00 committed by Santiago Pastorino
parent b45aebfdf6
commit 2cd09f27b8
No known key found for this signature in database
GPG key ID: 88C941CDA1D46432

View file

@ -11,11 +11,12 @@
//! 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, TyCtxt};
use rustc::ty::{self, ParamEnv, RegionVid, TyCtxt};
use rustc::ty::maps::Providers;
use rustc::lint::builtin::UNUSED_MUT;
use rustc::mir::{AggregateKind, BasicBlock, BorrowCheckResult, BorrowKind};
@ -45,6 +46,7 @@ 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;
@ -198,7 +200,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
let borrow_set = Rc::new(BorrowSet::build(tcx, mir));
// If we are in non-lexical mode, compute the non-lexical lifetimes.
let (regioncx, _polonius_output, opt_closure_req) = nll::compute_regions(
let (regioncx, polonius_output, opt_closure_req) = nll::compute_regions(
infcx,
def_id,
free_regions,
@ -251,6 +253,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
used_mut_upvars: SmallVec::new(),
borrow_set,
dominators,
polonius_output,
};
let mut state = Flows::new(
@ -373,6 +376,9 @@ 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: