rustc_mir_build::builder::scope

Function build_scope_drops

Source
fn build_scope_drops<'tcx>(
    cfg: &mut CFG<'tcx>,
    unwind_drops: &mut DropTree,
    scope: &Scope,
    block: BasicBlock,
    unwind_to: DropIdx,
    storage_dead_on_unwind: bool,
    arg_count: usize,
) -> BlockAnd<()>
Expand description

Builds drops for pop_scope and leave_top_scope.

§Parameters

  • unwind_drops, the drop tree data structure storing what needs to be cleaned up if unwind occurs
  • scope, describes the drops that will occur on exiting the scope in regular execution
  • block, the block to branch to once drops are complete (assuming no unwind occurs)
  • unwind_to, describes the drops that would occur at this point in the code if a panic occurred (a subset of the drops in scope, since we sometimes elide StorageDead and other instructions on unwinding)
  • storage_dead_on_unwind, if true, then we should emit StorageDead even when unwinding
  • arg_count, number of MIR local variables corresponding to fn arguments (used to assert that we don’t drop those)