@@ -87,7 +87,7 @@ fn borrowck_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, body_id: hir::BodyId) {
87
87
88
88
let mut bccx = & mut BorrowckCtxt {
89
89
tcx : tcx,
90
- tables : Some ( tables) ,
90
+ tables : tables,
91
91
} ;
92
92
93
93
let body = bccx. tcx . hir . body ( body_id) ;
@@ -159,17 +159,20 @@ fn build_borrowck_dataflow_data<'a, 'tcx>(this: &mut BorrowckCtxt<'a, 'tcx>,
159
159
/// the `BorrowckCtxt` itself , e.g. the flowgraph visualizer.
160
160
pub fn build_borrowck_dataflow_data_for_fn < ' a , ' tcx > (
161
161
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
162
- body : hir:: BodyId ,
162
+ body_id : hir:: BodyId ,
163
163
cfg : & cfg:: CFG )
164
164
-> ( BorrowckCtxt < ' a , ' tcx > , AnalysisData < ' a , ' tcx > )
165
165
{
166
+ let owner_id = tcx. hir . body_owner ( body_id) ;
167
+ let owner_def_id = tcx. hir . local_def_id ( owner_id) ;
168
+ let tables = tcx. item_tables ( owner_def_id) ;
166
169
167
170
let mut bccx = BorrowckCtxt {
168
171
tcx : tcx,
169
- tables : None ,
172
+ tables : tables ,
170
173
} ;
171
174
172
- let dataflow_data = build_borrowck_dataflow_data ( & mut bccx, cfg, body ) ;
175
+ let dataflow_data = build_borrowck_dataflow_data ( & mut bccx, cfg, body_id ) ;
173
176
( bccx, dataflow_data)
174
177
}
175
178
@@ -181,7 +184,7 @@ pub struct BorrowckCtxt<'a, 'tcx: 'a> {
181
184
182
185
// tables for the current thing we are checking; set to
183
186
// Some in `borrowck_fn` and cleared later
184
- tables : Option < & ' a ty:: TypeckTables < ' tcx > > ,
187
+ tables : & ' a ty:: TypeckTables < ' tcx > ,
185
188
}
186
189
187
190
///////////////////////////////////////////////////////////////////////////
@@ -472,8 +475,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
472
475
r_sup : & ' tcx ty:: Region )
473
476
-> bool
474
477
{
475
- self . tables . unwrap ( ) . free_region_map
476
- . is_subregion_of ( self . tcx , r_sub, r_sup)
478
+ self . tables . free_region_map . is_subregion_of ( self . tcx , r_sub, r_sup)
477
479
}
478
480
479
481
pub fn report ( & self , err : BckError < ' tcx > ) {
0 commit comments