@@ -34,11 +34,10 @@ use syntax_pos::Span;
34
34
use dataflow:: { do_dataflow, DebugFormatted } ;
35
35
use dataflow:: FlowAtLocation ;
36
36
use dataflow:: MoveDataParamEnv ;
37
- use dataflow:: { DataflowAnalysis , DataflowResultsConsumer } ;
37
+ use dataflow:: { DataflowResultsConsumer } ;
38
38
use dataflow:: { MaybeInitializedPlaces , MaybeUninitializedPlaces } ;
39
39
use dataflow:: { EverInitializedPlaces , MovingOutStatements } ;
40
40
use dataflow:: { BorrowData , Borrows , ReserveOrActivateIndex } ;
41
- use dataflow:: { ActiveBorrows , Reservations } ;
42
41
use dataflow:: indexes:: BorrowIndex ;
43
42
use dataflow:: move_paths:: { IllegalMoveOriginKind , MoveError } ;
44
43
use dataflow:: move_paths:: { HasMoveData , LookupResult , MoveData , MovePathIndex } ;
@@ -54,8 +53,6 @@ mod error_reporting;
54
53
mod flows;
55
54
mod prefixes;
56
55
57
- use std:: borrow:: Cow ;
58
-
59
56
pub ( crate ) mod nll;
60
57
61
58
pub fn provide ( providers : & mut Providers ) {
@@ -209,6 +206,18 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
209
206
} ;
210
207
let flow_inits = flow_inits; // remove mut
211
208
209
+ let flow_borrows = FlowAtLocation :: new ( do_dataflow (
210
+ tcx,
211
+ mir,
212
+ id,
213
+ & attributes,
214
+ & dead_unwinds,
215
+ Borrows :: new ( tcx, mir, opt_regioncx. clone ( ) , def_id, body_id) ,
216
+ |rs, i| {
217
+ DebugFormatted :: new ( & ( i. kind ( ) , rs. location ( i. borrow_index ( ) ) ) )
218
+ }
219
+ ) ) ;
220
+
212
221
let movable_generator = !match tcx. hir . get ( id) {
213
222
hir:: map:: Node :: NodeExpr ( & hir:: Expr {
214
223
node : hir:: ExprClosure ( .., Some ( hir:: GeneratorMovability :: Static ) ) ,
@@ -230,44 +239,12 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
230
239
} ,
231
240
access_place_error_reported : FxHashSet ( ) ,
232
241
reservation_error_reported : FxHashSet ( ) ,
233
- nonlexical_regioncx : opt_regioncx. clone ( ) ,
242
+ nonlexical_regioncx : opt_regioncx,
234
243
nonlexical_cause_info : None ,
235
244
} ;
236
245
237
- let borrows = Borrows :: new ( tcx, mir, opt_regioncx, def_id, body_id) ;
238
- let flow_reservations = do_dataflow (
239
- tcx,
240
- mir,
241
- id,
242
- & attributes,
243
- & dead_unwinds,
244
- Reservations :: new ( borrows) ,
245
- |rs, i| {
246
- // In principle we could make the dataflow ensure that
247
- // only reservation bits show up, and assert so here.
248
- //
249
- // In practice it is easier to be looser; in particular,
250
- // it is okay for the kill-sets to hold activation bits.
251
- DebugFormatted :: new ( & ( i. kind ( ) , rs. location ( i) ) )
252
- } ,
253
- ) ;
254
- let flow_active_borrows = {
255
- let reservations_on_entry = flow_reservations. 0 . sets . entry_set_state ( ) ;
256
- let reservations = flow_reservations. 0 . operator ;
257
- let a = DataflowAnalysis :: new_with_entry_sets (
258
- mir,
259
- & dead_unwinds,
260
- Cow :: Borrowed ( reservations_on_entry) ,
261
- ActiveBorrows :: new ( reservations) ,
262
- ) ;
263
- let results = a. run ( tcx, id, & attributes, |ab, i| {
264
- DebugFormatted :: new ( & ( i. kind ( ) , ab. location ( i) ) )
265
- } ) ;
266
- FlowAtLocation :: new ( results)
267
- } ;
268
-
269
246
let mut state = Flows :: new (
270
- flow_active_borrows ,
247
+ flow_borrows ,
271
248
flow_inits,
272
249
flow_uninits,
273
250
flow_move_outs,
0 commit comments