about summary refs log tree commit diff
path: root/tvix/eval/src/value/function.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/value/function.rs')
-rw-r--r--tvix/eval/src/value/function.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/tvix/eval/src/value/function.rs b/tvix/eval/src/value/function.rs
index c9664112f1cd..9ac35d43d837 100644
--- a/tvix/eval/src/value/function.rs
+++ b/tvix/eval/src/value/function.rs
@@ -65,7 +65,7 @@ impl Lambda {
 #[derive(Clone, Debug)]
 pub struct Closure {
     pub lambda: Rc<Lambda>,
-    pub upvalues: Upvalues,
+    pub upvalues: Rc<Upvalues>,
     /// true if all upvalues have been realised
     #[cfg(debug_assertions)]
     pub is_finalised: bool,
@@ -73,10 +73,13 @@ pub struct Closure {
 
 impl Closure {
     pub fn new(lambda: Rc<Lambda>) -> Self {
-        Self::new_with_upvalues(Upvalues::with_capacity(lambda.upvalue_count), lambda)
+        Self::new_with_upvalues(
+            Rc::new(Upvalues::with_capacity(lambda.upvalue_count)),
+            lambda,
+        )
     }
 
-    pub fn new_with_upvalues(upvalues: Upvalues, lambda: Rc<Lambda>) -> Self {
+    pub fn new_with_upvalues(upvalues: Rc<Upvalues>, lambda: Rc<Lambda>) -> Self {
         Closure {
             upvalues,
             lambda,