about summary refs log tree commit diff
path: root/tvix/eval/src/vm/mod.rs
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-12-12T09·52-0800
committerclbot <clbot@tvl.fyi>2023-12-12T16·09+0000
commit2949ee08f10f11a79af9b90933022ea40039462a (patch)
treef61f28721fddbb7b981aaa66d4aa3d6d0166e254 /tvix/eval/src/vm/mod.rs
parent52b68c053987c1567bacb6f14dad8ba92cd01afe (diff)
fix(tvix/eval): calling a catchable is catchable r/7187
When attempting to call a Value, if it is a Value::Catchable we must
not cause an uncatchable failure.  This commit simply reuses the
Value::Catchable as the result of attempting to call it.  This is
safe because nix is designed so that nix code cannot distinguish
between different catchable failures -- they all look the same to
the interpreted code.

This fixes b/351.

Change-Id: Ibf763a08753e541843626182ff59fdbf15ea2959
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10300
Autosubmit: Adam Joseph <adam@westernsemico.com>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval/src/vm/mod.rs')
-rw-r--r--tvix/eval/src/vm/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tvix/eval/src/vm/mod.rs b/tvix/eval/src/vm/mod.rs
index 3d3b47be23e3..d57bd21e44c7 100644
--- a/tvix/eval/src/vm/mod.rs
+++ b/tvix/eval/src/vm/mod.rs
@@ -1056,6 +1056,12 @@ impl<'o> VM<'o> {
                 self.enqueue_generator("__functor call", span, |co| call_functor(co, val));
                 Ok(())
             }
+
+            val @ Value::Catchable(_) => {
+                self.stack.push(val);
+                Ok(())
+            }
+
             v => Err(ErrorKind::NotCallable(v.type_of())).with_span(&span, self),
         }
     }