From 3fb0697a713cdd5b0c22b3c511419ba3a281746a Mon Sep 17 00:00:00 2001 From: Aspen Smith Date: Fri, 9 Feb 2024 12:59:04 -0500 Subject: fix(tvix/eval): Propagate catchables in NixAttrs::construct Correctly propagate the case where the *key* of an attrset is a Value::Catchable (eg { "${builtins.throw "c"}" = "b"; }) in `NixAttrs::construct`, by converting the return type to `Result, ErrorKind>` (ugh!!) and correctly handling that everywhere (including an `expect` in the Deserialize impl for NixAttrs, since afaict this is impossible to hit when deserializing from stuff like JSON). Change-Id: Ic4bc611fbfdab27c0bd8a40759689a87c4004a17 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10786 Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- tvix/eval/src/vm/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tvix/eval/src/vm/mod.rs') diff --git a/tvix/eval/src/vm/mod.rs b/tvix/eval/src/vm/mod.rs index d23bef6743ef..88d616fe3adc 100644 --- a/tvix/eval/src/vm/mod.rs +++ b/tvix/eval/src/vm/mod.rs @@ -932,9 +932,11 @@ where fn run_attrset(&mut self, frame: &CallFrame, count: usize) -> EvalResult<()> { let attrs = NixAttrs::construct(count, self.stack.split_off(self.stack.len() - count * 2)) - .with_span(frame, self)?; + .with_span(frame, self)? + .map(Value::attrs) + .into(); - self.stack.push(Value::attrs(attrs)); + self.stack.push(attrs); Ok(()) } -- cgit 1.4.1