Pass flow_inits by value.

It's simpler that way, and we don't need the explicit `drop`.
This commit is contained in:
Nicholas Nethercote
2024-11-05 11:52:38 +11:00
parent af50fe407e
commit 75108b6067
5 changed files with 7 additions and 11 deletions

View File

@@ -190,7 +190,7 @@ fn do_mir_borrowck<'tcx>(
.iter_enumerated()
.map(|(idx, body)| (idx, MoveData::gather_moves(body, tcx, |_| true)));
let mut flow_inits = MaybeInitializedPlaces::new(tcx, body, &move_data)
let flow_inits = MaybeInitializedPlaces::new(tcx, body, &move_data)
.iterate_to_fixpoint(tcx, body, Some("borrowck"))
.into_results_cursor(body);
@@ -211,16 +211,12 @@ fn do_mir_borrowck<'tcx>(
body,
&promoted,
&location_table,
&mut flow_inits,
flow_inits,
&move_data,
&borrow_set,
consumer_options,
);
// `flow_inits` is large, so we drop it as soon as possible. This reduces
// peak memory usage significantly on some benchmarks.
drop(flow_inits);
// Dump MIR results into a file, if that is enabled. This let us
// write unit-tests, as well as helping with debugging.
nll::dump_nll_mir(&infcx, body, &regioncx, &opt_closure_req, &borrow_set);