@@ -177,24 +177,6 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
177177 MaybeInitializedPlaces :: new ( tcx, mir, & mdpe) ,
178178 |bd, i| DebugFormatted :: new ( & bd. move_data ( ) . move_paths [ i] ) ,
179179 ) ) ;
180- let flow_uninits = FlowAtLocation :: new ( do_dataflow (
181- tcx,
182- mir,
183- id,
184- & attributes,
185- & dead_unwinds,
186- MaybeUninitializedPlaces :: new ( tcx, mir, & mdpe) ,
187- |bd, i| DebugFormatted :: new ( & bd. move_data ( ) . move_paths [ i] ) ,
188- ) ) ;
189- let flow_ever_inits = FlowAtLocation :: new ( do_dataflow (
190- tcx,
191- mir,
192- id,
193- & attributes,
194- & dead_unwinds,
195- EverInitializedPlaces :: new ( tcx, mir, & mdpe) ,
196- |bd, i| DebugFormatted :: new ( & bd. move_data ( ) . inits [ i] ) ,
197- ) ) ;
198180
199181 let locals_are_invalidated_at_exit = match tcx. hir . body_owner_kind ( id) {
200182 hir:: BodyOwnerKind :: Const | hir:: BodyOwnerKind :: Static ( _) => false ,
@@ -216,6 +198,12 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
216198 & borrow_set,
217199 & mut errors_buffer,
218200 ) ;
201+
202+ // The various `flow_*` structures can be large. We drop `flow_inits` here
203+ // so it doesn't overlap with the others below. This reduces peak memory
204+ // usage significantly on some benchmarks.
205+ drop ( flow_inits) ;
206+
219207 let regioncx = Rc :: new ( regioncx) ;
220208
221209 let flow_borrows = FlowAtLocation :: new ( do_dataflow (
@@ -227,6 +215,24 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
227215 Borrows :: new ( tcx, mir, regioncx. clone ( ) , def_id, body_id, & borrow_set) ,
228216 |rs, i| DebugFormatted :: new ( & rs. location ( i) ) ,
229217 ) ) ;
218+ let flow_uninits = FlowAtLocation :: new ( do_dataflow (
219+ tcx,
220+ mir,
221+ id,
222+ & attributes,
223+ & dead_unwinds,
224+ MaybeUninitializedPlaces :: new ( tcx, mir, & mdpe) ,
225+ |bd, i| DebugFormatted :: new ( & bd. move_data ( ) . move_paths [ i] ) ,
226+ ) ) ;
227+ let flow_ever_inits = FlowAtLocation :: new ( do_dataflow (
228+ tcx,
229+ mir,
230+ id,
231+ & attributes,
232+ & dead_unwinds,
233+ EverInitializedPlaces :: new ( tcx, mir, & mdpe) ,
234+ |bd, i| DebugFormatted :: new ( & bd. move_data ( ) . inits [ i] ) ,
235+ ) ) ;
230236
231237 let movable_generator = match tcx. hir . get ( id) {
232238 Node :: Expr ( & hir:: Expr {
0 commit comments