Function rustc_mir_transform::nrvo::local_eligible_for_nrvo

source ·
fn local_eligible_for_nrvo(body: &Body<'_>) -> Option<Local>
Expand description

MIR that is eligible for the NRVO must fulfill two conditions:

  1. The return place must not be read prior to the Return terminator.
  2. A simple assignment of a whole local to the return place (e.g., _0 = _1) must be the only definition of the return place reaching the Return terminator.

If the MIR fulfills both these conditions, this function returns the Local that is assigned to the return place along all possible paths through the control-flow graph.