summaryrefslogtreecommitdiffstats
path: root/src/librustc_mir/borrow_check/mod.rs
diff options
context:
space:
mode:
authorDouglas Campos <qmx@qmx.me>2018-05-26 01:14:45 +0000
committerSantiago Pastorino <spastorino@gmail.com>2018-05-29 10:19:46 -0300
commit2cd09f27b835d4342ce6f87eaf250eceb2718db8 (patch)
tree24cf4948e1ff9cbdee99d5cfb9cdf5f7a6dd7bb7 /src/librustc_mir/borrow_check/mod.rs
parentit compiles, but we do not use the output yet (diff)
downloadgrust-2cd09f27b835d4342ce6f87eaf250eceb2718db8.tar.gz
grust-2cd09f27b835d4342ce6f87eaf250eceb2718db8.tar.bz2
grust-2cd09f27b835d4342ce6f87eaf250eceb2718db8.tar.xz
store polonius output in MirBorrowCtx
Diffstat (limited to 'src/librustc_mir/borrow_check/mod.rs')
-rw-r--r--src/librustc_mir/borrow_check/mod.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index 397cf1680e..e2d696e9b0 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -11,11 +11,12 @@
11//! This query borrow-checks the MIR to (further) ensure it is not broken. 11//! This query borrow-checks the MIR to (further) ensure it is not broken.
12 12
13use borrow_check::nll::region_infer::RegionInferenceContext; 13use borrow_check::nll::region_infer::RegionInferenceContext;
14use borrow_check::location::LocationIndex;
14use rustc::hir; 15use rustc::hir;
15use rustc::hir::def_id::DefId; 16use rustc::hir::def_id::DefId;
16use rustc::hir::map::definitions::DefPathData; 17use rustc::hir::map::definitions::DefPathData;
17use rustc::infer::InferCtxt; 18use rustc::infer::InferCtxt;
18use rustc::ty::{self, ParamEnv, TyCtxt}; 19use rustc::ty::{self, ParamEnv, RegionVid, TyCtxt};
19use rustc::ty::maps::Providers; 20use rustc::ty::maps::Providers;
20use rustc::lint::builtin::UNUSED_MUT; 21use rustc::lint::builtin::UNUSED_MUT;
21use rustc::mir::{AggregateKind, BasicBlock, BorrowCheckResult, BorrowKind}; 22use rustc::mir::{AggregateKind, BasicBlock, BorrowCheckResult, BorrowKind};
@@ -45,6 +46,7 @@ use dataflow::move_paths::{IllegalMoveOriginKind, MoveError};
45use dataflow::move_paths::{HasMoveData, LookupResult, MoveData, MovePathIndex}; 46use dataflow::move_paths::{HasMoveData, LookupResult, MoveData, MovePathIndex};
46use util::borrowck_errors::{BorrowckErrors, Origin}; 47use util::borrowck_errors::{BorrowckErrors, Origin};
47use util::collect_writes::FindAssignments; 48use util::collect_writes::FindAssignments;
49use polonius_engine::Output;
48 50
49use self::borrow_set::{BorrowSet, BorrowData}; 51use self::borrow_set::{BorrowSet, BorrowData};
50use self::flows::Flows; 52use self::flows::Flows;
@@ -198,7 +200,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
198 let borrow_set = Rc::new(BorrowSet::build(tcx, mir)); 200 let borrow_set = Rc::new(BorrowSet::build(tcx, mir));
199 201
200 // If we are in non-lexical mode, compute the non-lexical lifetimes. 202 // If we are in non-lexical mode, compute the non-lexical lifetimes.
201 let (regioncx, _polonius_output, opt_closure_req) = nll::compute_regions( 203 let (regioncx, polonius_output, opt_closure_req) = nll::compute_regions(
202 infcx, 204 infcx,
203 def_id, 205 def_id,
204 free_regions, 206 free_regions,
@@ -251,6 +253,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
251 used_mut_upvars: SmallVec::new(), 253 used_mut_upvars: SmallVec::new(),
252 borrow_set, 254 borrow_set,
253 dominators, 255 dominators,
256 polonius_output,
254 }; 257 };
255 258
256 let mut state = Flows::new( 259 let mut state = Flows::new(
@@ -373,6 +376,9 @@ pub struct MirBorrowckCtxt<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
373 376
374 /// Dominators for MIR 377 /// Dominators for MIR
375 dominators: Dominators<BasicBlock>, 378 dominators: Dominators<BasicBlock>,
379
380 /// Polonius Output
381 polonius_output: Option<Rc<Output<RegionVid, BorrowIndex, LocationIndex>>>,
376} 382}
377 383
378// Check that: 384// Check that: