@@ -34,11 +34,10 @@ use syntax_pos::Span;
3434use dataflow:: { do_dataflow, DebugFormatted } ;
3535use dataflow:: FlowAtLocation ;
3636use dataflow:: MoveDataParamEnv ;
37- use dataflow:: { DataflowAnalysis , DataflowResultsConsumer } ;
37+ use dataflow:: { DataflowResultsConsumer } ;
3838use dataflow:: { MaybeInitializedPlaces , MaybeUninitializedPlaces } ;
3939use dataflow:: { EverInitializedPlaces , MovingOutStatements } ;
4040use dataflow:: { BorrowData , Borrows , ReserveOrActivateIndex } ;
41- use dataflow:: { ActiveBorrows , Reservations } ;
4241use dataflow:: indexes:: BorrowIndex ;
4342use dataflow:: move_paths:: { IllegalMoveOriginKind , MoveError } ;
4443use dataflow:: move_paths:: { HasMoveData , LookupResult , MoveData , MovePathIndex } ;
@@ -54,8 +53,6 @@ mod error_reporting;
5453mod flows;
5554mod prefixes;
5655
57- use std:: borrow:: Cow ;
58-
5956pub ( crate ) mod nll;
6057
6158pub fn provide ( providers : & mut Providers ) {
@@ -209,6 +206,18 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
209206 } ;
210207 let flow_inits = flow_inits; // remove mut
211208
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+
212221 let movable_generator = !match tcx. hir . get ( id) {
213222 hir:: map:: Node :: NodeExpr ( & hir:: Expr {
214223 node : hir:: ExprClosure ( .., Some ( hir:: GeneratorMovability :: Static ) ) ,
@@ -230,44 +239,12 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
230239 } ,
231240 access_place_error_reported : FxHashSet ( ) ,
232241 reservation_error_reported : FxHashSet ( ) ,
233- nonlexical_regioncx : opt_regioncx. clone ( ) ,
242+ nonlexical_regioncx : opt_regioncx,
234243 nonlexical_cause_info : None ,
235244 } ;
236245
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-
269246 let mut state = Flows :: new (
270- flow_active_borrows ,
247+ flow_borrows ,
271248 flow_inits,
272249 flow_uninits,
273250 flow_move_outs,
0 commit comments