@@ -23,19 +23,19 @@ use rustc_data_structures::fx::FxHashSet;
23
23
use syntax:: codemap:: DUMMY_SP ;
24
24
use borrow_check:: FlowInProgress ;
25
25
use dataflow:: MaybeInitializedLvals ;
26
- use dataflow:: move_paths:: { MoveData , LookupResult } ;
26
+ use dataflow:: move_paths:: MoveData ;
27
27
28
28
use super :: LivenessResults ;
29
29
use super :: ToRegionVid ;
30
30
use super :: region_infer:: RegionInferenceContext ;
31
31
32
- pub ( super ) fn generate_constraints < ' a , ' gcx , ' tcx > (
33
- infcx : & InferCtxt < ' a , ' gcx , ' tcx > ,
32
+ pub ( super ) fn generate_constraints < ' cx , ' gcx , ' tcx > (
33
+ infcx : & InferCtxt < ' cx , ' gcx , ' tcx > ,
34
34
regioncx : & mut RegionInferenceContext < ' tcx > ,
35
35
mir : & Mir < ' tcx > ,
36
36
mir_source : MirSource ,
37
37
liveness : & LivenessResults ,
38
- flow_inits : & FlowInProgress < MaybeInitializedLvals < ' a , ' gcx , ' tcx > > ,
38
+ flow_inits : & FlowInProgress < MaybeInitializedLvals < ' cx , ' gcx , ' tcx > > ,
39
39
move_data : & MoveData < ' tcx > ,
40
40
) {
41
41
ConstraintGeneration {
@@ -49,17 +49,18 @@ pub(super) fn generate_constraints<'a, 'gcx, 'tcx>(
49
49
} . add_constraints ( ) ;
50
50
}
51
51
52
- struct ConstraintGeneration < ' a , ' cx : ' a , ' gcx : ' tcx , ' tcx : ' cx > {
53
- infcx : & ' a InferCtxt < ' cx , ' gcx , ' tcx > ,
54
- regioncx : & ' a mut RegionInferenceContext < ' tcx > ,
55
- mir : & ' a Mir < ' tcx > ,
56
- liveness : & ' a LivenessResults ,
52
+ /// 'cg = the duration of the constraint generation process itself.
53
+ struct ConstraintGeneration < ' cg , ' cx : ' cg , ' gcx : ' tcx , ' tcx : ' cx > {
54
+ infcx : & ' cg InferCtxt < ' cx , ' gcx , ' tcx > ,
55
+ regioncx : & ' cg mut RegionInferenceContext < ' tcx > ,
56
+ mir : & ' cg Mir < ' tcx > ,
57
+ liveness : & ' cg LivenessResults ,
57
58
mir_source : MirSource ,
58
- flow_inits : & ' a FlowInProgress < MaybeInitializedLvals < ' cx , ' gcx , ' tcx > > ,
59
- move_data : & ' a MoveData < ' tcx > ,
59
+ flow_inits : & ' cg FlowInProgress < MaybeInitializedLvals < ' cx , ' gcx , ' tcx > > ,
60
+ move_data : & ' cg MoveData < ' tcx > ,
60
61
}
61
62
62
- impl < ' a , ' cx , ' gcx , ' tcx > ConstraintGeneration < ' a , ' cx , ' gcx , ' tcx > {
63
+ impl < ' cx , ' cg , ' gcx , ' tcx > ConstraintGeneration < ' cx , ' cg , ' gcx , ' tcx > {
63
64
fn add_constraints ( & mut self ) {
64
65
self . add_liveness_constraints ( ) ;
65
66
self . add_borrow_constraints ( ) ;
@@ -88,13 +89,10 @@ impl<'a, 'cx, 'gcx, 'tcx> ConstraintGeneration<'a, 'cx, 'gcx, 'tcx> {
88
89
bb,
89
90
|location, live_locals| {
90
91
for live_local in live_locals. iter ( ) {
91
- if let LookupResult :: Exact ( mpi) =
92
- self . move_data . rev_lookup . find ( & Lvalue :: Local ( live_local) )
93
- {
94
- if self . flow_inits . has_any_child_of ( mpi) . is_some ( ) {
95
- let live_local_ty = self . mir . local_decls [ live_local] . ty ;
96
- self . add_drop_live_constraint ( live_local_ty, location) ;
97
- }
92
+ let mpi = self . move_data . rev_lookup . find_local ( live_local) ;
93
+ if self . flow_inits . has_any_child_of ( mpi) . is_some ( ) {
94
+ let live_local_ty = self . mir . local_decls [ live_local] . ty ;
95
+ self . add_drop_live_constraint ( live_local_ty, location) ;
98
96
}
99
97
}
100
98
} ,
@@ -232,7 +230,7 @@ impl<'a, 'cx, 'gcx, 'tcx> ConstraintGeneration<'a, 'cx, 'gcx, 'tcx> {
232
230
}
233
231
}
234
232
235
- impl < ' a , ' cx , ' gcx , ' tcx > Visitor < ' tcx > for ConstraintGeneration < ' a , ' cx , ' gcx , ' tcx > {
233
+ impl < ' cg , ' cx , ' gcx , ' tcx > Visitor < ' tcx > for ConstraintGeneration < ' cg , ' cx , ' gcx , ' tcx > {
236
234
fn visit_rvalue ( & mut self ,
237
235
rvalue : & Rvalue < ' tcx > ,
238
236
location : Location ) {
0 commit comments