rustc_mir_transform::sroa

Function escaping_locals

Source
fn escaping_locals<'tcx>(
    tcx: TyCtxt<'tcx>,
    param_env: ParamEnv<'tcx>,
    excluded: &BitSet<Local>,
    body: &Body<'tcx>,
) -> BitSet<Local>
Expand description

Identify all locals that are not eligible for SROA.

There are 3 cases:

  • the aggregated local is used or passed to other code (function parameters and arguments);
  • the locals is a union or an enum;
  • the local’s address is taken, and thus the relative addresses of the fields are observable to client code.