Skip to main content

expr_skip_clone

Function expr_skip_clone 

Source
pub fn expr_skip_clone(expr: &ResolvedExpr, ectx: &EmitCtx) -> bool
Expand description

Should .clone() be skipped for this expression? True for: Copy types, last-use locals, globals/namespaces. False for: rc_wrapped, borrowed_params (need special clone paths).

For ResolvedExpr::Ident: in Rust codegen, Ident is used for both globals AND locals (resolver still leaves bare globals as Ident). Check ectx to distinguish:

  • If name is in local_types → local/param, apply rc_wrapped/borrowed checks
  • If name is NOT in local_types → global/namespace, skip clone