@@ -15,8 +15,8 @@ use borrow_check::borrow_set::BorrowSet;
15
15
use borrow_check:: location:: LocationTable ;
16
16
use borrow_check:: nll:: constraints:: { ConstraintSet , OutlivesConstraint } ;
17
17
use borrow_check:: nll:: facts:: AllFacts ;
18
- use borrow_check:: nll:: region_infer:: { ClosureRegionRequirementsExt , TypeTest , RegionValues } ;
19
- use borrow_check:: nll:: region_infer:: { RegionValueElements } ;
18
+ use borrow_check:: nll:: region_infer:: { ClosureRegionRequirementsExt , TypeTest } ;
19
+ use borrow_check:: nll:: region_infer:: values :: { RegionValues , RegionValueElements } ;
20
20
use borrow_check:: nll:: universal_regions:: UniversalRegions ;
21
21
use borrow_check:: nll:: ToRegionVid ;
22
22
use dataflow:: move_paths:: MoveData ;
@@ -123,7 +123,7 @@ pub(crate) fn type_check<'gcx, 'tcx>(
123
123
} ;
124
124
125
125
{
126
- let borrowck_context = BorrowCheckContext {
126
+ let mut borrowck_context = BorrowCheckContext {
127
127
universal_regions,
128
128
location_table,
129
129
borrow_set,
@@ -138,8 +138,8 @@ pub(crate) fn type_check<'gcx, 'tcx>(
138
138
mir,
139
139
& universal_regions. region_bound_pairs ,
140
140
Some ( implicit_region_bound) ,
141
- & mut Some ( borrowck_context) ,
142
- & mut |cx| {
141
+ Some ( & mut borrowck_context) ,
142
+ |cx| {
143
143
liveness:: generate ( cx, mir, liveness, flow_inits, move_data) ;
144
144
145
145
cx. equate_inputs_and_outputs ( mir, mir_def_id, universal_regions) ;
@@ -150,16 +150,18 @@ pub(crate) fn type_check<'gcx, 'tcx>(
150
150
constraints
151
151
}
152
152
153
- fn type_check_internal < ' a , ' gcx , ' tcx > (
153
+ fn type_check_internal < ' a , ' gcx , ' tcx , F > (
154
154
infcx : & ' a InferCtxt < ' a , ' gcx , ' tcx > ,
155
155
mir_def_id : DefId ,
156
156
param_env : ty:: ParamEnv < ' gcx > ,
157
157
mir : & ' a Mir < ' tcx > ,
158
158
region_bound_pairs : & ' a [ ( ty:: Region < ' tcx > , GenericKind < ' tcx > ) ] ,
159
159
implicit_region_bound : Option < ty:: Region < ' tcx > > ,
160
- borrowck_context : & ' a mut Option < BorrowCheckContext < ' a , ' tcx > > ,
161
- extra : & ' a mut dyn FnMut ( & mut TypeChecker < ' a , ' gcx , ' tcx > ) ,
162
- ) {
160
+ borrowck_context : Option < & ' a mut BorrowCheckContext < ' a , ' tcx > > ,
161
+ mut extra : F ,
162
+ )
163
+ where F : FnMut ( & mut TypeChecker < ' a , ' gcx , ' tcx > )
164
+ {
163
165
let mut checker = TypeChecker :: new (
164
166
infcx,
165
167
mir,
@@ -617,7 +619,7 @@ struct TypeChecker<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
617
619
region_bound_pairs : & ' a [ ( ty:: Region < ' tcx > , GenericKind < ' tcx > ) ] ,
618
620
implicit_region_bound : Option < ty:: Region < ' tcx > > ,
619
621
reported_errors : FxHashSet < ( Ty < ' tcx > , Span ) > ,
620
- borrowck_context : & ' a mut Option < BorrowCheckContext < ' a , ' tcx > > ,
622
+ borrowck_context : Option < & ' a mut BorrowCheckContext < ' a , ' tcx > > ,
621
623
}
622
624
623
625
struct BorrowCheckContext < ' a , ' tcx : ' a > {
@@ -730,7 +732,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
730
732
param_env : ty:: ParamEnv < ' gcx > ,
731
733
region_bound_pairs : & ' a [ ( ty:: Region < ' tcx > , GenericKind < ' tcx > ) ] ,
732
734
implicit_region_bound : Option < ty:: Region < ' tcx > > ,
733
- borrowck_context : & ' a mut Option < BorrowCheckContext < ' a , ' tcx > > ,
735
+ borrowck_context : Option < & ' a mut BorrowCheckContext < ' a , ' tcx > > ,
734
736
) -> Self {
735
737
TypeChecker {
736
738
infcx,
@@ -779,7 +781,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
779
781
locations, data
780
782
) ;
781
783
782
- if let Some ( borrowck_context) = & mut self . borrowck_context {
784
+ if let Some ( ref mut borrowck_context) = self . borrowck_context {
783
785
constraint_conversion:: ConstraintConversion :: new (
784
786
self . infcx . tcx ,
785
787
borrowck_context. universal_regions ,
@@ -1005,7 +1007,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1005
1007
// output) types in the signature must be live, since
1006
1008
// all the inputs that fed into it were live.
1007
1009
for & late_bound_region in map. values ( ) {
1008
- if let Some ( borrowck_context) = self . borrowck_context {
1010
+ if let Some ( ref mut borrowck_context) = self . borrowck_context {
1009
1011
let region_vid = borrowck_context. universal_regions . to_region_vid (
1010
1012
late_bound_region) ;
1011
1013
borrowck_context. constraints
@@ -1505,8 +1507,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1505
1507
all_facts,
1506
1508
constraints,
1507
1509
..
1508
- } = match & mut self . borrowck_context {
1509
- Some ( borrowck_context) => borrowck_context,
1510
+ } = match self . borrowck_context {
1511
+ Some ( ref mut borrowck_context) => borrowck_context,
1510
1512
None => return ,
1511
1513
} ;
1512
1514
@@ -1809,7 +1811,7 @@ impl MirPass for TypeckMir {
1809
1811
1810
1812
let param_env = tcx. param_env ( def_id) ;
1811
1813
tcx. infer_ctxt ( ) . enter ( |infcx| {
1812
- type_check_internal ( & infcx, def_id, param_env, mir, & [ ] , None , & mut None , & mut |_| ( ) ) ;
1814
+ type_check_internal ( & infcx, def_id, param_env, mir, & [ ] , None , None , |_| ( ) ) ;
1813
1815
1814
1816
// For verification purposes, we just ignore the resulting
1815
1817
// region constraint sets. Not our problem. =)
0 commit comments