Skip to content

Commit 0a282ea

Browse files
committed
Move WriteInfo out of Allocations.
It doesn't need to be in there, and the move simplifies lifetimes.
1 parent c6111c0 commit 0a282ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/rustc_mir_transform/src/dest_prop.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
165165
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
166166
let def_id = body.source.def_id();
167167
let mut allocations = Allocations::default();
168+
let mut write_info = WriteInfo::default();
168169
trace!(func = ?tcx.def_path_str(def_id));
169170

170171
let borrowed = rustc_mir_dataflow::impls::borrowed_locals(body);
@@ -205,7 +206,7 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
205206
&mut candidates,
206207
&points,
207208
&live,
208-
&mut allocations.write_info,
209+
&mut write_info,
209210
body,
210211
);
211212

@@ -262,7 +263,6 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
262263
struct Allocations {
263264
candidates: FxIndexMap<Local, Vec<Local>>,
264265
candidates_reverse: FxIndexMap<Local, Vec<Local>>,
265-
write_info: WriteInfo,
266266
// PERF: Do this for `MaybeLiveLocals` allocations too.
267267
}
268268

@@ -364,7 +364,7 @@ struct FilterInformation<'a, 'alloc, 'tcx> {
364364
points: &'a DenseLocationMap,
365365
live: &'a SparseIntervalMatrix<Local, PointIndex>,
366366
candidates: &'a mut Candidates<'alloc>,
367-
write_info: &'alloc mut WriteInfo,
367+
write_info: &'a mut WriteInfo,
368368
at: Location,
369369
}
370370

@@ -468,7 +468,7 @@ impl<'a, 'alloc, 'tcx> FilterInformation<'a, 'alloc, 'tcx> {
468468
candidates: &mut Candidates<'alloc>,
469469
points: &DenseLocationMap,
470470
live: &SparseIntervalMatrix<Local, PointIndex>,
471-
write_info: &'alloc mut WriteInfo,
471+
write_info: &mut WriteInfo,
472472
body: &Body<'tcx>,
473473
) {
474474
let mut this = FilterInformation {

0 commit comments

Comments
 (0)