fn local_eligible_for_nrvo(body: &Body<'_>) -> Option<Local>
Expand description
MIR that is eligible for the NRVO must fulfill two conditions:
- The return place must not be read prior to the
Return
terminator. - 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 theReturn
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.