Skip to content

Commit 1724b3b

Browse files
committed
Remove some _cursor/_results suffixes.
Results and cursors normally don't have suffixes. By slightly changing the order here and introducing one shadowed local variable, we can deal with results first, then convert to cursors, removing the need for the suffixes.
1 parent 63e7cc1 commit 1724b3b

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

compiler/rustc_mir_transform/src/coroutine.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -672,18 +672,17 @@ fn locals_live_across_suspend_points<'tcx>(
672672

673673
// Calculate the MIR locals which have been previously
674674
// borrowed (even if they are still active).
675-
let borrowed_locals_results =
675+
let borrowed_locals =
676676
MaybeBorrowedLocals.into_engine(tcx, body).pass_name("coroutine").iterate_to_fixpoint();
677677

678-
let mut borrowed_locals_cursor = borrowed_locals_results.clone().into_results_cursor(body);
679-
680-
// Calculate the MIR locals that we actually need to keep storage around
681-
// for.
682-
let mut requires_storage_cursor = MaybeRequiresStorage::new(body, borrowed_locals_results)
678+
// Calculate the MIR locals for which we need to keep storage around.
679+
let mut requires_storage = MaybeRequiresStorage::new(body, borrowed_locals.clone())
683680
.into_engine(tcx, body)
684681
.iterate_to_fixpoint()
685682
.into_results_cursor(body);
686683

684+
let mut borrowed_locals = borrowed_locals.into_results_cursor(body);
685+
687686
// Calculate the liveness of MIR locals ignoring borrows.
688687
let mut liveness = MaybeLiveLocals
689688
.into_engine(tcx, body)
@@ -715,8 +714,8 @@ fn locals_live_across_suspend_points<'tcx>(
715714
// If a borrow is converted to a raw reference, we must also assume that it lives
716715
// forever. Note that the final liveness is still bounded by the storage liveness
717716
// of the local, which happens using the `intersect` operation below.
718-
borrowed_locals_cursor.seek_before_primary_effect(loc);
719-
live_locals.union(borrowed_locals_cursor.get());
717+
borrowed_locals.seek_before_primary_effect(loc);
718+
live_locals.union(borrowed_locals.get());
720719
}
721720

722721
// Store the storage liveness for later use so we can restore the state
@@ -727,8 +726,8 @@ fn locals_live_across_suspend_points<'tcx>(
727726
// Locals live are live at this point only if they are used across
728727
// suspension points (the `liveness` variable)
729728
// and their storage is required (the `storage_required` variable)
730-
requires_storage_cursor.seek_before_primary_effect(loc);
731-
live_locals.intersect(requires_storage_cursor.get());
729+
requires_storage.seek_before_primary_effect(loc);
730+
live_locals.intersect(requires_storage.get());
732731

733732
// The coroutine argument is ignored.
734733
live_locals.remove(SELF_ARG);
@@ -758,7 +757,7 @@ fn locals_live_across_suspend_points<'tcx>(
758757
body,
759758
&saved_locals,
760759
always_live_locals.clone(),
761-
requires_storage_cursor.into_results(),
760+
requires_storage.into_results(),
762761
);
763762

764763
LivenessInfo {

0 commit comments

Comments
 (0)