rustc_mir_transform::coroutine

Function locals_live_across_suspend_points

source
fn locals_live_across_suspend_points<'tcx>(
    tcx: TyCtxt<'tcx>,
    body: &Body<'tcx>,
    always_live_locals: &BitSet<Local>,
    movable: bool,
) -> LivenessInfo
Expand description

Computes which locals have to be stored in the state-machine for the given coroutine.

The basic idea is as follows:

  • a local is live until we encounter a StorageDead statement. In case none exist, the local is considered to be always live.
  • a local has to be stored if it is either directly used after the the suspend point, or if it is live and has been previously borrowed.