@@ -177,24 +177,6 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
177
177
MaybeInitializedPlaces :: new ( tcx, mir, & mdpe) ,
178
178
|bd, i| DebugFormatted :: new ( & bd. move_data ( ) . move_paths [ i] ) ,
179
179
) ) ;
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
- ) ) ;
198
180
199
181
let locals_are_invalidated_at_exit = match tcx. hir . body_owner_kind ( id) {
200
182
hir:: BodyOwnerKind :: Const | hir:: BodyOwnerKind :: Static ( _) => false ,
@@ -216,6 +198,12 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
216
198
& borrow_set,
217
199
& mut errors_buffer,
218
200
) ;
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
+
219
207
let regioncx = Rc :: new ( regioncx) ;
220
208
221
209
let flow_borrows = FlowAtLocation :: new ( do_dataflow (
@@ -227,6 +215,24 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
227
215
Borrows :: new ( tcx, mir, regioncx. clone ( ) , def_id, body_id, & borrow_set) ,
228
216
|rs, i| DebugFormatted :: new ( & rs. location ( i) ) ,
229
217
) ) ;
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
+ ) ) ;
230
236
231
237
let movable_generator = match tcx. hir . get ( id) {
232
238
Node :: Expr ( & hir:: Expr {
0 commit comments