env_push_owned

Function env_push_owned 

Source
pub fn env_push_owned(env: Env, val: Val) -> Env
Expand description

Push a value onto an owned environment, returning a new Env.

Consumes env directly, so Rc::make_mut sees the caller’s refcount unchanged. When the caller is the sole owner (refcount == 1), this mutates the underlying Vec<Val> in place — no clone of the vector, no clone of the Rc. When other handles exist (e.g. a captured closure environment also references this Env), the standard copy-on-write clone still happens.

Used in the CK machine wherever a Cont arm has just taken ownership of its env field and is about to install a new env into a child Mode::Eval — see the LetBody, EvalmsFinish, and BinOpFinish App paths in eval/machine.rs.