@@ -12,19 +12,20 @@ use borrow_check::borrow_set::BorrowSet;
12
12
use borrow_check:: location:: LocationTable ;
13
13
use borrow_check:: nll:: ToRegionVid ;
14
14
use borrow_check:: nll:: facts:: AllFacts ;
15
- use borrow_check:: nll:: region_infer:: RegionInferenceContext ;
15
+ use borrow_check:: nll:: region_infer:: values :: { RegionValueElements , RegionValues } ;
16
16
use rustc:: infer:: InferCtxt ;
17
17
use rustc:: mir:: visit:: TyContext ;
18
18
use rustc:: mir:: visit:: Visitor ;
19
19
use rustc:: mir:: { BasicBlock , BasicBlockData , Location , Mir , Place , Rvalue } ;
20
20
use rustc:: mir:: { Local , Statement , Terminator } ;
21
21
use rustc:: ty:: fold:: TypeFoldable ;
22
22
use rustc:: ty:: subst:: Substs ;
23
- use rustc:: ty:: { self , CanonicalTy , ClosureSubsts , GeneratorSubsts } ;
23
+ use rustc:: ty:: { self , CanonicalTy , ClosureSubsts , GeneratorSubsts , RegionVid } ;
24
24
25
25
pub ( super ) fn generate_constraints < ' cx , ' gcx , ' tcx > (
26
26
infcx : & InferCtxt < ' cx , ' gcx , ' tcx > ,
27
- regioncx : & mut RegionInferenceContext < ' tcx > ,
27
+ elements : & RegionValueElements ,
28
+ liveness_constraints : & mut RegionValues < RegionVid > ,
28
29
all_facts : & mut Option < AllFacts > ,
29
30
location_table : & LocationTable ,
30
31
mir : & Mir < ' tcx > ,
@@ -33,9 +34,10 @@ pub(super) fn generate_constraints<'cx, 'gcx, 'tcx>(
33
34
let mut cg = ConstraintGeneration {
34
35
borrow_set,
35
36
infcx,
36
- regioncx ,
37
+ liveness_constraints ,
37
38
location_table,
38
39
all_facts,
40
+ elements,
39
41
} ;
40
42
41
43
for ( bb, data) in mir. basic_blocks ( ) . iter_enumerated ( ) {
@@ -48,8 +50,9 @@ struct ConstraintGeneration<'cg, 'cx: 'cg, 'gcx: 'tcx, 'tcx: 'cx> {
48
50
infcx : & ' cg InferCtxt < ' cx , ' gcx , ' tcx > ,
49
51
all_facts : & ' cg mut Option < AllFacts > ,
50
52
location_table : & ' cg LocationTable ,
51
- regioncx : & ' cg mut RegionInferenceContext < ' tcx > ,
53
+ liveness_constraints : & ' cg mut RegionValues < RegionVid > ,
52
54
borrow_set : & ' cg BorrowSet < ' tcx > ,
55
+ elements : & ' cg RegionValueElements ,
53
56
}
54
57
55
58
impl < ' cg , ' cx , ' gcx , ' tcx > Visitor < ' tcx > for ConstraintGeneration < ' cg , ' cx , ' gcx , ' tcx > {
@@ -202,7 +205,7 @@ impl<'cx, 'cg, 'gcx, 'tcx> ConstraintGeneration<'cx, 'cg, 'gcx, 'tcx> {
202
205
. tcx
203
206
. for_each_free_region ( & live_ty, |live_region| {
204
207
let vid = live_region. to_region_vid ( ) ;
205
- self . regioncx . add_live_element ( vid, location) ;
208
+ self . liveness_constraints . add_element ( & self . elements , vid, location) ;
206
209
} ) ;
207
210
}
208
211
}
0 commit comments