record_subexpr_extended_temp_scopes

Function record_subexpr_extended_temp_scopes 

Source
fn record_subexpr_extended_temp_scopes(
    scope_tree: &mut ScopeTree,
    expr: &Expr<'_>,
    lifetime: Option<Scope>,
)
Expand description

Applied to an expression expr if expr – or something owned or partially owned by expr – is going to be indirectly referenced by a variable in a let statement. In that case, the “temporary lifetime” of expr is extended to be the block enclosing the let statement.

More formally, if expr matches the grammar ET, record the temporary scope of the matching <rvalue> as lifetime:

    ET = *ET
       | ET[...]
       | ET.f
       | (ET)
       | <rvalue>

Note: ET is intended to match “rvalues or places based on rvalues”.