about summary refs log tree commit diff
path: root/tvix/eval/src/builtins
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-11-20T22·35+0100
committertazjin <tazjin@tvl.su>2022-11-21T14·14+0000
commitf7907db69d07d9358a269e86237524b0142c23c0 (patch)
treec8f0f5da94e5faa2e6f50740442acc99246011dd /tvix/eval/src/builtins
parent994bf03b74672d3a8602e7dc1b73de1fd97830a3 (diff)
fix(tvix/eval): builtins.listToAttrs must force keys r/5298
Change-Id: Ief9ebc2285a0c50654c2edd3351432dc1588f9fc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7313
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src/builtins')
-rw-r--r--tvix/eval/src/builtins/mod.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs
index 3ceafa498fcd..89e7c37d3f20 100644
--- a/tvix/eval/src/builtins/mod.rs
+++ b/tvix/eval/src/builtins/mod.rs
@@ -537,13 +537,8 @@ mod pure_builtins {
         let mut map = BTreeMap::new();
         for val in list {
             let attrs = val.force(vm)?.to_attrs()?;
-            let get = |key| {
-                attrs
-                    .select(key)
-                    .ok_or(ErrorKind::AttributeNotFound { name: key.into() })
-            };
-            let name = get("name")?.to_str()?;
-            let value = get("value")?.clone();
+            let name = attrs.select_required("name")?.force(vm)?.to_str()?;
+            let value = attrs.select_required("value")?.clone();
             // Map entries earlier in the list take precedence over entries later in the list
             map.entry(name).or_insert(value);
         }