11
11
use borrow_check:: borrow_set:: BorrowSet ;
12
12
use borrow_check:: location:: LocationTable ;
13
13
use borrow_check:: nll:: facts:: AllFacts ;
14
- use borrow_check:: nll:: region_infer:: { Cause , RegionInferenceContext } ;
14
+ use borrow_check:: nll:: region_infer:: RegionInferenceContext ;
15
15
use borrow_check:: nll:: ToRegionVid ;
16
16
use rustc:: hir;
17
17
use rustc:: infer:: InferCtxt ;
@@ -32,7 +32,7 @@ pub(super) fn generate_constraints<'cx, 'gcx, 'tcx>(
32
32
location_table : & LocationTable ,
33
33
mir : & Mir < ' tcx > ,
34
34
borrow_set : & BorrowSet < ' tcx > ,
35
- liveness_set_from_typeck : & [ ( ty:: Region < ' tcx > , Location , Cause ) ] ,
35
+ liveness_set_from_typeck : & [ ( ty:: Region < ' tcx > , Location ) ] ,
36
36
) {
37
37
let mut cg = ConstraintGeneration {
38
38
borrow_set,
@@ -68,14 +68,14 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx
68
68
/// We sometimes have `substs` within an rvalue, or within a
69
69
/// call. Make them live at the location where they appear.
70
70
fn visit_substs ( & mut self , substs : & & ' tcx Substs < ' tcx > , location : Location ) {
71
- self . add_regular_live_constraint ( * substs, location, Cause :: LiveOther ( location ) ) ;
71
+ self . add_regular_live_constraint ( * substs, location) ;
72
72
self . super_substs ( substs) ;
73
73
}
74
74
75
75
/// We sometimes have `region` within an rvalue, or within a
76
76
/// call. Make them live at the location where they appear.
77
77
fn visit_region ( & mut self , region : & ty:: Region < ' tcx > , location : Location ) {
78
- self . add_regular_live_constraint ( * region, location, Cause :: LiveOther ( location ) ) ;
78
+ self . add_regular_live_constraint ( * region, location) ;
79
79
self . super_region ( region) ;
80
80
}
81
81
@@ -93,7 +93,7 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx
93
93
) ;
94
94
}
95
95
TyContext :: Location ( location) => {
96
- self . add_regular_live_constraint ( * ty, location, Cause :: LiveOther ( location ) ) ;
96
+ self . add_regular_live_constraint ( * ty, location) ;
97
97
}
98
98
}
99
99
@@ -103,14 +103,14 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx
103
103
/// We sometimes have `generator_substs` within an rvalue, or within a
104
104
/// call. Make them live at the location where they appear.
105
105
fn visit_generator_substs ( & mut self , substs : & GeneratorSubsts < ' tcx > , location : Location ) {
106
- self . add_regular_live_constraint ( * substs, location, Cause :: LiveOther ( location ) ) ;
106
+ self . add_regular_live_constraint ( * substs, location) ;
107
107
self . super_generator_substs ( substs) ;
108
108
}
109
109
110
110
/// We sometimes have `closure_substs` within an rvalue, or within a
111
111
/// call. Make them live at the location where they appear.
112
112
fn visit_closure_substs ( & mut self , substs : & ClosureSubsts < ' tcx > , location : Location ) {
113
- self . add_regular_live_constraint ( * substs, location, Cause :: LiveOther ( location ) ) ;
113
+ self . add_regular_live_constraint ( * substs, location) ;
114
114
self . super_closure_substs ( substs) ;
115
115
}
116
116
@@ -232,7 +232,7 @@ impl<'cx, 'cg, 'gcx, 'tcx> ConstraintGeneration<'cx, 'cg, 'gcx, 'tcx> {
232
232
/// that we also have to respect.
233
233
fn add_region_liveness_constraints_from_type_check (
234
234
& mut self ,
235
- liveness_set : & [ ( ty:: Region < ' tcx > , Location , Cause ) ] ,
235
+ liveness_set : & [ ( ty:: Region < ' tcx > , Location ) ] ,
236
236
) {
237
237
debug ! (
238
238
"add_region_liveness_constraints_from_type_check(liveness_set={} items)" ,
@@ -246,16 +246,16 @@ impl<'cx, 'cg, 'gcx, 'tcx> ConstraintGeneration<'cx, 'cg, 'gcx, 'tcx> {
246
246
..
247
247
} = self ;
248
248
249
- for ( region, location, cause ) in liveness_set {
249
+ for ( region, location) in liveness_set {
250
250
debug ! ( "generate: {:#?} is live at {:#?}" , region, location) ;
251
251
let region_vid = regioncx. to_region_vid ( region) ;
252
- regioncx. add_live_point ( region_vid, * location, & cause ) ;
252
+ regioncx. add_live_point ( region_vid, * location) ;
253
253
}
254
254
255
255
if let Some ( all_facts) = all_facts {
256
256
all_facts
257
257
. region_live_at
258
- . extend ( liveness_set. into_iter ( ) . flat_map ( |( region, location, _ ) | {
258
+ . extend ( liveness_set. into_iter ( ) . flat_map ( |( region, location) | {
259
259
let r = regioncx. to_region_vid ( region) ;
260
260
let p1 = location_table. start_index ( * location) ;
261
261
let p2 = location_table. mid_index ( * location) ;
@@ -268,7 +268,7 @@ impl<'cx, 'cg, 'gcx, 'tcx> ConstraintGeneration<'cx, 'cg, 'gcx, 'tcx> {
268
268
/// `location` -- i.e., it may be used later. This means that all
269
269
/// regions appearing in the type `live_ty` must be live at
270
270
/// `location`.
271
- fn add_regular_live_constraint < T > ( & mut self , live_ty : T , location : Location , cause : Cause )
271
+ fn add_regular_live_constraint < T > ( & mut self , live_ty : T , location : Location )
272
272
where
273
273
T : TypeFoldable < ' tcx > ,
274
274
{
@@ -281,7 +281,7 @@ impl<'cx, 'cg, 'gcx, 'tcx> ConstraintGeneration<'cx, 'cg, 'gcx, 'tcx> {
281
281
. tcx
282
282
. for_each_free_region ( & live_ty, |live_region| {
283
283
let vid = live_region. to_region_vid ( ) ;
284
- self . regioncx . add_live_point ( vid, location, & cause ) ;
284
+ self . regioncx . add_live_point ( vid, location) ;
285
285
} ) ;
286
286
}
287
287
0 commit comments