about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-11-23 17:59:54 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-11-27 10:35:43 +1100
commit3dea72aa1bf0ed5e5ccd36e8ee6c1c97976e5d25 (patch)
tree50c1c7dc21685a950d8246ce1c48efc3f3d08f01
parentd957c4718377b8cb0dacc58cdbaa5a3fe82c53cc (diff)
downloadrust-3dea72aa1bf0ed5e5ccd36e8ee6c1c97976e5d25.tar.gz
rust-3dea72aa1bf0ed5e5ccd36e8ee6c1c97976e5d25.zip
Remove one use of `as_results_cursor`.
It's currently used because `requires_storage_results` is used in two
locations: once with a cursor, and once later on without a cursor. The
non-consuming `as_results_cursor` is used for the first location.

But we can instead use the consuming `into_results_cursor` and then use
`into_results` to extract the `Results` from the finished-with cursor
for use at the second location.
-rw-r--r--compiler/rustc_mir_transform/src/coroutine.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_mir_transform/src/coroutine.rs b/compiler/rustc_mir_transform/src/coroutine.rs
index 1cb1a9886a0..8d9555c63cf 100644
--- a/compiler/rustc_mir_transform/src/coroutine.rs
+++ b/compiler/rustc_mir_transform/src/coroutine.rs
@@ -684,11 +684,11 @@ fn locals_live_across_suspend_points<'tcx>(
 
     // Calculate the MIR locals that we actually need to keep storage around
     // for.
-    let mut requires_storage_results =
+    let mut requires_storage_cursor =
         MaybeRequiresStorage::new(borrowed_locals_results.cloned_results_cursor(body))
             .into_engine(tcx, body)
-            .iterate_to_fixpoint();
-    let mut requires_storage_cursor = requires_storage_results.as_results_cursor(body);
+            .iterate_to_fixpoint()
+            .into_results_cursor(body);
 
     // Calculate the liveness of MIR locals ignoring borrows.
     let mut liveness = MaybeLiveLocals
@@ -764,7 +764,7 @@ fn locals_live_across_suspend_points<'tcx>(
         body,
         &saved_locals,
         always_live_locals.clone(),
-        requires_storage_results,
+        requires_storage_cursor.into_results(),
     );
 
     LivenessInfo {