Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove an unneeded local variable.
`body` is already a `&Body`.
  • Loading branch information
nnethercote committed Nov 23, 2023
commit e4fc5df7cca4d18a9ccce0d6d735a4cf2643aecd
20 changes: 9 additions & 11 deletions compiler/rustc_mir_transform/src/coroutine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,36 +651,34 @@ fn locals_live_across_suspend_points<'tcx>(
always_live_locals: &BitSet<Local>,
movable: bool,
) -> LivenessInfo {
let body_ref: &Body<'_> = body;

// Calculate when MIR locals have live storage. This gives us an upper bound of their
// lifetimes.
let mut storage_live = MaybeStorageLive::new(std::borrow::Cow::Borrowed(always_live_locals))
.into_engine(tcx, body_ref)
.into_engine(tcx, body)
.iterate_to_fixpoint()
.into_results_cursor(body_ref);
.into_results_cursor(body);

// Calculate the MIR locals which have been previously
// borrowed (even if they are still active).
let borrowed_locals_results =
MaybeBorrowedLocals.into_engine(tcx, body_ref).pass_name("coroutine").iterate_to_fixpoint();
MaybeBorrowedLocals.into_engine(tcx, body).pass_name("coroutine").iterate_to_fixpoint();

let mut borrowed_locals_cursor = borrowed_locals_results.cloned_results_cursor(body_ref);
let mut borrowed_locals_cursor = borrowed_locals_results.cloned_results_cursor(body);

// Calculate the MIR locals that we actually need to keep storage around
// for.
let mut requires_storage_results =
MaybeRequiresStorage::new(borrowed_locals_results.cloned_results_cursor(body))
.into_engine(tcx, body_ref)
.into_engine(tcx, body)
.iterate_to_fixpoint();
let mut requires_storage_cursor = requires_storage_results.as_results_cursor(body_ref);
let mut requires_storage_cursor = requires_storage_results.as_results_cursor(body);

// Calculate the liveness of MIR locals ignoring borrows.
let mut liveness = MaybeLiveLocals
.into_engine(tcx, body_ref)
.into_engine(tcx, body)
.pass_name("coroutine")
.iterate_to_fixpoint()
.into_results_cursor(body_ref);
.into_results_cursor(body);

let mut storage_liveness_map = IndexVec::from_elem(None, &body.basic_blocks);
let mut live_locals_at_suspension_points = Vec::new();
Expand Down Expand Up @@ -746,7 +744,7 @@ fn locals_live_across_suspend_points<'tcx>(
.collect();

let storage_conflicts = compute_storage_conflicts(
body_ref,
body,
&saved_locals,
always_live_locals.clone(),
requires_storage_results,
Expand Down