diff options
author | Douglas Campos <qmx@qmx.me> | 2018-05-26 01:14:45 +0000 |
---|---|---|
committer | Santiago Pastorino <spastorino@gmail.com> | 2018-05-29 10:19:46 -0300 |
commit | 2cd09f27b835d4342ce6f87eaf250eceb2718db8 (patch) | |
tree | 24cf4948e1ff9cbdee99d5cfb9cdf5f7a6dd7bb7 /src | |
parent | it compiles, but we do not use the output yet (diff) | |
download | grust-2cd09f27b835d4342ce6f87eaf250eceb2718db8.tar.gz grust-2cd09f27b835d4342ce6f87eaf250eceb2718db8.tar.bz2 grust-2cd09f27b835d4342ce6f87eaf250eceb2718db8.tar.xz |
store polonius output in MirBorrowCtx
Diffstat (limited to 'src')
-rw-r--r-- | src/librustc_mir/borrow_check/mod.rs | 10 |
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 | ||
13 | use borrow_check::nll::region_infer::RegionInferenceContext; | 13 | use borrow_check::nll::region_infer::RegionInferenceContext; |
14 | use borrow_check::location::LocationIndex; | ||
14 | use rustc::hir; | 15 | use rustc::hir; |
15 | use rustc::hir::def_id::DefId; | 16 | use rustc::hir::def_id::DefId; |
16 | use rustc::hir::map::definitions::DefPathData; | 17 | use rustc::hir::map::definitions::DefPathData; |
17 | use rustc::infer::InferCtxt; | 18 | use rustc::infer::InferCtxt; |
18 | use rustc::ty::{self, ParamEnv, TyCtxt}; | 19 | use rustc::ty::{self, ParamEnv, RegionVid, TyCtxt}; |
19 | use rustc::ty::maps::Providers; | 20 | use rustc::ty::maps::Providers; |
20 | use rustc::lint::builtin::UNUSED_MUT; | 21 | use rustc::lint::builtin::UNUSED_MUT; |
21 | use rustc::mir::{AggregateKind, BasicBlock, BorrowCheckResult, BorrowKind}; | 22 | use rustc::mir::{AggregateKind, BasicBlock, BorrowCheckResult, BorrowKind}; |
@@ -45,6 +46,7 @@ use dataflow::move_paths::{IllegalMoveOriginKind, MoveError}; | |||
45 | use dataflow::move_paths::{HasMoveData, LookupResult, MoveData, MovePathIndex}; | 46 | use dataflow::move_paths::{HasMoveData, LookupResult, MoveData, MovePathIndex}; |
46 | use util::borrowck_errors::{BorrowckErrors, Origin}; | 47 | use util::borrowck_errors::{BorrowckErrors, Origin}; |
47 | use util::collect_writes::FindAssignments; | 48 | use util::collect_writes::FindAssignments; |
49 | use polonius_engine::Output; | ||
48 | 50 | ||
49 | use self::borrow_set::{BorrowSet, BorrowData}; | 51 | use self::borrow_set::{BorrowSet, BorrowData}; |
50 | use self::flows::Flows; | 52 | use 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: |