@@ -147,13 +147,13 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
147
147
}
148
148
149
149
#[ allow( dead_code) ]
150
- pub struct MirBorrowckCtxt < ' c , ' b , ' a : ' b + ' c , ' gcx : ' a + ' tcx , ' tcx : ' a > {
151
- tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
152
- mir : & ' b Mir < ' tcx > ,
150
+ pub struct MirBorrowckCtxt < ' cx , ' gcx : ' tcx , ' tcx : ' cx > {
151
+ tcx : TyCtxt < ' cx , ' gcx , ' tcx > ,
152
+ mir : & ' cx Mir < ' tcx > ,
153
153
node_id : ast:: NodeId ,
154
- move_data : & ' b MoveData < ' tcx > ,
155
- param_env : ParamEnv < ' tcx > ,
156
- fake_infer_ctxt : & ' c InferCtxt < ' c , ' gcx , ' tcx > ,
154
+ move_data : & ' cx MoveData < ' tcx > ,
155
+ param_env : ParamEnv < ' gcx > ,
156
+ fake_infer_ctxt : & ' cx InferCtxt < ' cx , ' gcx , ' tcx > ,
157
157
}
158
158
159
159
// (forced to be `pub` due to its use as an associated type below.)
@@ -175,12 +175,10 @@ struct FlowInProgress<BD> where BD: BitDenotation {
175
175
// 2. loans made in overlapping scopes do not conflict
176
176
// 3. assignments do not affect things loaned out as immutable
177
177
// 4. moves do not affect things loaned out in any way
178
- impl < ' c , ' b , ' a : ' b +' c , ' gcx , ' tcx : ' a > DataflowResultsConsumer < ' b , ' tcx >
179
- for MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx >
180
- {
181
- type FlowState = InProgress < ' b , ' gcx , ' tcx > ;
178
+ impl < ' cx , ' gcx , ' tcx > DataflowResultsConsumer < ' cx , ' tcx > for MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
179
+ type FlowState = InProgress < ' cx , ' gcx , ' tcx > ;
182
180
183
- fn mir ( & self ) -> & ' b Mir < ' tcx > { self . mir }
181
+ fn mir ( & self ) -> & ' cx Mir < ' tcx > { self . mir }
184
182
185
183
fn reset_to_entry_of ( & mut self , bb : BasicBlock , flow_state : & mut Self :: FlowState ) {
186
184
flow_state. each_flow ( |b| b. reset_to_entry_of ( bb) ,
@@ -431,12 +429,12 @@ enum WriteKind {
431
429
Move ,
432
430
}
433
431
434
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
432
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
435
433
fn access_lvalue ( & mut self ,
436
434
context : Context ,
437
435
lvalue_span : ( & Lvalue < ' tcx > , Span ) ,
438
436
kind : ( ShallowOrDeep , ReadOrWrite ) ,
439
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
437
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
440
438
// FIXME: also need to check permissions (e.g. reject mut
441
439
// borrow of immutable ref, moves through non-`Box`-ref)
442
440
let ( sd, rw) = kind;
@@ -492,7 +490,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
492
490
lvalue_span : ( & Lvalue < ' tcx > , Span ) ,
493
491
kind : ShallowOrDeep ,
494
492
mode : MutateMode ,
495
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
493
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
496
494
// Write of P[i] or *P, or WriteAndRead of any P, requires P init'd.
497
495
match mode {
498
496
MutateMode :: WriteAndRead => {
@@ -513,7 +511,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
513
511
context : Context ,
514
512
( rvalue, span) : ( & Rvalue < ' tcx > , Span ) ,
515
513
_location : Location ,
516
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
514
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
517
515
match * rvalue {
518
516
Rvalue :: Ref ( _/*rgn*/ , bk, ref lvalue) => {
519
517
let access_kind = match bk {
@@ -570,7 +568,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
570
568
context : Context ,
571
569
consume_via_drop : ConsumeKind ,
572
570
( operand, span) : ( & Operand < ' tcx > , Span ) ,
573
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
571
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
574
572
match * operand {
575
573
Operand :: Consume ( ref lvalue) => {
576
574
self . consume_lvalue ( context, consume_via_drop, ( lvalue, span) , flow_state)
@@ -583,7 +581,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
583
581
context : Context ,
584
582
consume_via_drop : ConsumeKind ,
585
583
lvalue_span : ( & Lvalue < ' tcx > , Span ) ,
586
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
584
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
587
585
let lvalue = lvalue_span. 0 ;
588
586
let ty = lvalue. ty ( self . mir , self . tcx ) . to_ty ( self . tcx ) ;
589
587
let moves_by_default =
@@ -610,11 +608,11 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
610
608
}
611
609
}
612
610
613
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
611
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
614
612
fn check_if_reassignment_to_immutable_state ( & mut self ,
615
613
context : Context ,
616
614
( lvalue, span) : ( & Lvalue < ' tcx > , Span ) ,
617
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
615
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
618
616
let move_data = self . move_data ;
619
617
620
618
// determine if this path has a non-mut owner (and thus needs checking).
@@ -665,7 +663,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
665
663
context : Context ,
666
664
desired_action : & str ,
667
665
lvalue_span : ( & Lvalue < ' tcx > , Span ) ,
668
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
666
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
669
667
// FIXME: analogous code in check_loans first maps `lvalue` to
670
668
// its base_path ... but is that what we want here?
671
669
let lvalue = self . base_path ( lvalue_span. 0 ) ;
@@ -788,7 +786,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
788
786
fn check_if_assigned_path_is_moved ( & mut self ,
789
787
context : Context ,
790
788
( lvalue, span) : ( & Lvalue < ' tcx > , Span ) ,
791
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ) {
789
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ) {
792
790
// recur down lvalue; dispatch to check_if_path_is_moved when necessary
793
791
let mut lvalue = lvalue;
794
792
loop {
@@ -853,11 +851,11 @@ enum NoMovePathFound {
853
851
ReachedStatic ,
854
852
}
855
853
856
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
854
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
857
855
fn each_borrow_involving_path < F > ( & mut self ,
858
856
_context : Context ,
859
857
access_lvalue : ( ShallowOrDeep , & Lvalue < ' tcx > ) ,
860
- flow_state : & InProgress < ' b , ' gcx , ' tcx > ,
858
+ flow_state : & InProgress < ' cx , ' gcx , ' tcx > ,
861
859
mut op : F )
862
860
where F : FnMut ( & mut Self , BorrowIndex , & BorrowData < ' tcx > , & Lvalue ) -> Control
863
861
{
@@ -957,11 +955,11 @@ mod prefixes {
957
955
}
958
956
959
957
960
- pub ( super ) struct Prefixes < ' c , ' gcx : ' tcx , ' tcx : ' c > {
961
- mir : & ' c Mir < ' tcx > ,
962
- tcx : TyCtxt < ' c , ' gcx , ' tcx > ,
958
+ pub ( super ) struct Prefixes < ' cx , ' gcx : ' tcx , ' tcx : ' cx > {
959
+ mir : & ' cx Mir < ' tcx > ,
960
+ tcx : TyCtxt < ' cx , ' gcx , ' tcx > ,
963
961
kind : PrefixSet ,
964
- next : Option < & ' c Lvalue < ' tcx > > ,
962
+ next : Option < & ' cx Lvalue < ' tcx > > ,
965
963
}
966
964
967
965
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
@@ -975,21 +973,21 @@ mod prefixes {
975
973
Supporting ,
976
974
}
977
975
978
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
976
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
979
977
/// Returns an iterator over the prefixes of `lvalue`
980
978
/// (inclusive) from longest to smallest, potentially
981
979
/// terminating the iteration early based on `kind`.
982
- pub ( super ) fn prefixes < ' d > ( & self ,
983
- lvalue : & ' d Lvalue < ' tcx > ,
984
- kind : PrefixSet )
985
- -> Prefixes < ' d , ' gcx , ' tcx > where ' b : ' d
980
+ pub ( super ) fn prefixes ( & self ,
981
+ lvalue : & ' cx Lvalue < ' tcx > ,
982
+ kind : PrefixSet )
983
+ -> Prefixes < ' cx , ' gcx , ' tcx >
986
984
{
987
985
Prefixes { next : Some ( lvalue) , kind, mir : self . mir , tcx : self . tcx }
988
986
}
989
987
}
990
988
991
- impl < ' c , ' gcx , ' tcx > Iterator for Prefixes < ' c , ' gcx , ' tcx > {
992
- type Item = & ' c Lvalue < ' tcx > ;
989
+ impl < ' cx , ' gcx , ' tcx > Iterator for Prefixes < ' cx , ' gcx , ' tcx > {
990
+ type Item = & ' cx Lvalue < ' tcx > ;
993
991
fn next ( & mut self ) -> Option < Self :: Item > {
994
992
let mut cursor = match self . next {
995
993
None => return None ,
@@ -1082,7 +1080,7 @@ mod prefixes {
1082
1080
}
1083
1081
}
1084
1082
1085
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
1083
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
1086
1084
fn report_use_of_moved ( & mut self ,
1087
1085
_context : Context ,
1088
1086
desired_action : & str ,
@@ -1203,7 +1201,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
1203
1201
}
1204
1202
}
1205
1203
1206
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
1204
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
1207
1205
// End-user visible description of `lvalue`
1208
1206
fn describe_lvalue ( & self , lvalue : & Lvalue ) -> String {
1209
1207
let mut buf = String :: new ( ) ;
@@ -1338,7 +1336,7 @@ impl<'c, 'b, 'a: 'b+'c, 'gcx, 'tcx: 'a> MirBorrowckCtxt<'c, 'b, 'a, 'gcx, 'tcx>
1338
1336
}
1339
1337
}
1340
1338
1341
- impl < ' c , ' b , ' a : ' b + ' c , ' gcx , ' tcx : ' a > MirBorrowckCtxt < ' c , ' b , ' a , ' gcx , ' tcx > {
1339
+ impl < ' cx , ' gcx , ' tcx > MirBorrowckCtxt < ' cx , ' gcx , ' tcx > {
1342
1340
// FIXME (#16118): function intended to allow the borrow checker
1343
1341
// to be less precise in its handling of Box while still allowing
1344
1342
// moves out of a Box. They should be removed when/if we stop
0 commit comments