@@ -148,13 +148,13 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
148
148
}
149
149
150
150
#[ allow( dead_code) ]
151
- pub struct MirBorrowckCtxt < ' c , ' b , ' a : ' b + ' c , ' gcx : ' a + ' tcx , ' tcx : ' a > {
152
- tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
153
- mir : & ' b Mir < ' tcx > ,
151
+ pub struct MirBorrowckCtxt < ' cx , ' gcx : ' tcx , ' tcx : ' cx > {
152
+ tcx : TyCtxt < ' cx , ' gcx , ' tcx > ,
153
+ mir : & ' cx Mir < ' tcx > ,
154
154
node_id : ast:: NodeId ,
155
- move_data : & ' b MoveData < ' tcx > ,
156
- param_env : ParamEnv < ' tcx > ,
157
- fake_infer_ctxt : & ' c InferCtxt < ' c , ' gcx , ' tcx > ,
155
+ move_data : & ' cx MoveData < ' tcx > ,
156
+ param_env : ParamEnv < ' gcx > ,
157
+ fake_infer_ctxt : & ' cx InferCtxt < ' cx , ' gcx , ' tcx > ,
158
158
}
159
159
160
160
// (forced to be `pub` due to its use as an associated type below.)
@@ -177,12 +177,10 @@ struct FlowInProgress<BD> where BD: BitDenotation {
177
177
// 2. loans made in overlapping scopes do not conflict
178
178
// 3. assignments do not affect things loaned out as immutable
179
179
// 4. moves do not affect things loaned out in any way
180
- impl < ' c , ' b , ' a : ' b +' c , ' gcx , ' tcx : ' a > DataflowResultsConsumer < ' b , ' tcx >
181
- for MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx >
182
- {
183
- type FlowState = InProgress < ' b , ' gcx , ' tcx > ;
180
+ impl < ' cx , ' gcx , ' tcx > DataflowResultsConsumer < ' cx , ' tcx > for MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
181
+ type FlowState = InProgress < ' cx , ' gcx , ' tcx > ;
184
182
185
- fn mir ( & self ) -> & ' b Mir < ' tcx > { self . mir }
183
+ fn mir ( & self ) -> & ' cx Mir < ' tcx > { self . mir }
186
184
187
185
fn reset_to_entry_of ( & mut self , bb : BasicBlock , flow_state : & mut Self :: FlowState ) {
188
186
flow_state. each_flow ( |b| b. reset_to_entry_of ( bb) ,
@@ -437,12 +435,12 @@ enum WriteKind {
437
435
Move ,
438
436
}
439
437
440
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
438
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
441
439
fn access_lvalue ( & mut self ,
442
440
context : Context ,
443
441
lvalue_span : ( & Lvalue < ' tcx > , Span ) ,
444
442
kind : ( ShallowOrDeep , ReadOrWrite ) ,
445
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
443
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
446
444
447
445
let ( sd, rw) = kind;
448
446
@@ -501,7 +499,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
501
499
lvalue_span : ( & Lvalue < ' tcx > , Span ) ,
502
500
kind : ShallowOrDeep ,
503
501
mode : MutateMode ,
504
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
502
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
505
503
// Write of P[i] or *P, or WriteAndRead of any P, requires P init'd.
506
504
match mode {
507
505
MutateMode :: WriteAndRead => {
@@ -522,7 +520,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
522
520
context : Context ,
523
521
( rvalue, span) : ( & Rvalue < ' tcx > , Span ) ,
524
522
_location : Location ,
525
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
523
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
526
524
match * rvalue {
527
525
Rvalue :: Ref ( _/*rgn*/ , bk, ref lvalue) => {
528
526
let access_kind = match bk {
@@ -579,7 +577,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
579
577
context : Context ,
580
578
consume_via_drop : ConsumeKind ,
581
579
( operand, span) : ( & Operand < ' tcx > , Span ) ,
582
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
580
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
583
581
match * operand {
584
582
Operand :: Consume ( ref lvalue) => {
585
583
self . consume_lvalue ( context, consume_via_drop, ( lvalue, span) , flow_state)
@@ -592,7 +590,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
592
590
context : Context ,
593
591
consume_via_drop : ConsumeKind ,
594
592
lvalue_span : ( & Lvalue < ' tcx > , Span ) ,
595
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
593
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
596
594
let lvalue = lvalue_span. 0 ;
597
595
let ty = lvalue. ty ( self . mir , self . tcx ) . to_ty ( self . tcx ) ;
598
596
let moves_by_default =
@@ -619,11 +617,11 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
619
617
}
620
618
}
621
619
622
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
620
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
623
621
fn check_if_reassignment_to_immutable_state ( & mut self ,
624
622
context : Context ,
625
623
( lvalue, span) : ( & Lvalue < ' tcx > , Span ) ,
626
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
624
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
627
625
let move_data = self . move_data ;
628
626
629
627
// determine if this path has a non-mut owner (and thus needs checking).
@@ -674,7 +672,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
674
672
context : Context ,
675
673
desired_action : & str ,
676
674
lvalue_span : ( & Lvalue < ' tcx > , Span ) ,
677
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
675
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
678
676
// FIXME: analogous code in check_loans first maps `lvalue` to
679
677
// its base_path ... but is that what we want here?
680
678
let lvalue = self . base_path ( lvalue_span. 0 ) ;
@@ -802,7 +800,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
802
800
fn check_if_assigned_path_is_moved ( & mut self ,
803
801
context : Context ,
804
802
( lvalue, span) : ( & Lvalue < ' tcx > , Span ) ,
805
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
803
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
806
804
// recur down lvalue; dispatch to check_if_path_is_moved when necessary
807
805
let mut lvalue = lvalue;
808
806
loop {
@@ -1015,11 +1013,11 @@ enum NoMovePathFound {
1015
1013
ReachedStatic ,
1016
1014
}
1017
1015
1018
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
1016
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
1019
1017
fn each_borrow_involving_path < F > ( & mut self ,
1020
1018
_context : Context ,
1021
1019
access_lvalue : ( ShallowOrDeep , & Lvalue < ' tcx > ) ,
1022
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ,
1020
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ,
1023
1021
mut op : F )
1024
1022
where F : FnMut ( & mut Self , BorrowIndex , & BorrowData < ' tcx > , & Lvalue ) -> Control
1025
1023
{
@@ -1119,11 +1117,11 @@ mod prefixes {
1119
1117
}
1120
1118
1121
1119
1122
- pub ( super ) struct Prefixes < ' c , ' gcx : ' tcx , ' tcx : ' c > {
1123
- mir : & ' c Mir < ' tcx > ,
1124
- tcx : TyCtxt < ' c , ' gcx , ' tcx > ,
1120
+ pub ( super ) struct Prefixes < ' cx , ' gcx : ' tcx , ' tcx : ' cx > {
1121
+ mir : & ' cx Mir < ' tcx > ,
1122
+ tcx : TyCtxt < ' cx , ' gcx , ' tcx > ,
1125
1123
kind : PrefixSet ,
1126
- next : Option < & ' c Lvalue < ' tcx > > ,
1124
+ next : Option < & ' cx Lvalue < ' tcx > > ,
1127
1125
}
1128
1126
1129
1127
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
@@ -1137,21 +1135,21 @@ mod prefixes {
1137
1135
Supporting ,
1138
1136
}
1139
1137
1140
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
1138
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
1141
1139
/// Returns an iterator over the prefixes of `lvalue`
1142
1140
/// (inclusive) from longest to smallest, potentially
1143
1141
/// terminating the iteration early based on `kind`.
1144
- pub ( super ) fn prefixes < ' d > ( & self ,
1145
- lvalue : & ' d Lvalue < ' tcx > ,
1146
- kind : PrefixSet )
1147
- -> Prefixes < ' d , ' gcx , ' tcx > where ' b : ' d
1142
+ pub ( super ) fn prefixes ( & self ,
1143
+ lvalue : & ' cx Lvalue < ' tcx > ,
1144
+ kind : PrefixSet )
1145
+ -> Prefixes < ' cx , ' gcx , ' tcx >
1148
1146
{
1149
1147
Prefixes { next : Some ( lvalue) , kind, mir : self . mir , tcx : self . tcx }
1150
1148
}
1151
1149
}
1152
1150
1153
- impl < ' c , ' gcx , ' tcx > Iterator for Prefixes < ' c , ' gcx , ' tcx > {
1154
- type Item = & ' c Lvalue < ' tcx > ;
1151
+ impl < ' cx , ' gcx , ' tcx > Iterator for Prefixes < ' cx , ' gcx , ' tcx > {
1152
+ type Item = & ' cx Lvalue < ' tcx > ;
1155
1153
fn next ( & mut self ) -> Option < Self :: Item > {
1156
1154
let mut cursor = match self . next {
1157
1155
None => return None ,
@@ -1244,7 +1242,7 @@ mod prefixes {
1244
1242
}
1245
1243
}
1246
1244
1247
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
1245
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
1248
1246
fn report_use_of_moved_or_uninitialized ( & mut self ,
1249
1247
_context : Context ,
1250
1248
desired_action : & str ,
@@ -1481,7 +1479,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
1481
1479
}
1482
1480
}
1483
1481
1484
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
1482
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
1485
1483
// End-user visible description of `lvalue`
1486
1484
fn describe_lvalue ( & self , lvalue : & Lvalue ) -> String {
1487
1485
let mut buf = String :: new ( ) ;
@@ -1616,7 +1614,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
1616
1614
}
1617
1615
}
1618
1616
1619
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
1617
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
1620
1618
// FIXME (#16118): function intended to allow the borrow checker
1621
1619
// to be less precise in its handling of Box while still allowing
1622
1620
// moves out of a Box. They should be removed when/if we stop
0 commit comments