diff options
author | Aspen Smith <root@gws.fyi> | 2024-02-09T17·59-0500 |
---|---|---|
committer | aspen <root@gws.fyi> | 2024-02-09T19·11+0000 |
commit | 3fb0697a713cdd5b0c22b3c511419ba3a281746a (patch) | |
tree | 4cc88884ea59a3da8d9fcfcdf7e1110757b260d0 /tvix/eval/src/vm/mod.rs | |
parent | 7a589b3ec67e49edc6de1d3378db1c4c594210f1 (diff) |
fix(tvix/eval): Propagate catchables in NixAttrs::construct r/7492
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<Result<Self, CatchableErrorKind>, 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 <tvl@lahfa.xyz> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/vm/mod.rs')
-rw-r--r-- | tvix/eval/src/vm/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
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(()) } |