From e04b1697e4f4e8236418571c1f5938f0a9717bb7 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 27 Nov 2022 00:54:39 -0800 Subject: feat(tvix/eval): wrap Closure in Rc<> to match cppnix semantics Change-Id: I595087eff943d38a9fc78a83d37e207bb2ab79bc Reviewed-on: https://cl.tvl.fyi/c/depot/+/7443 Reviewed-by: grfn Tested-by: BuildkiteCI --- tvix/eval/src/value/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tvix/eval/src/value/mod.rs') diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index 2bca9e6d3202..af75bc9a7346 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -41,7 +41,7 @@ pub enum Value { Path(PathBuf), Attrs(Rc), List(NixList), - Closure(Closure), + Closure(Rc), // must use Rc here in order to get proper pointer equality Builtin(Builtin), // Internal values that, while they technically exist at runtime, @@ -304,7 +304,13 @@ impl Value { gen_cast!(to_str, NixString, "string", Value::String(s), s.clone()); gen_cast!(to_attrs, Rc, "set", Value::Attrs(a), a.clone()); gen_cast!(to_list, NixList, "list", Value::List(l), l.clone()); - gen_cast!(to_closure, Closure, "lambda", Value::Closure(c), c.clone()); + gen_cast!( + as_closure, + Rc, + "lambda", + Value::Closure(c), + c.clone() + ); gen_cast_mut!(as_list_mut, NixList, "list", List); -- cgit 1.4.1