diff options
author | Vincent Ambo <mail@tazj.in> | 2022-11-20T22·35+0100 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-11-21T14·14+0000 |
commit | f7907db69d07d9358a269e86237524b0142c23c0 (patch) | |
tree | c8f0f5da94e5faa2e6f50740442acc99246011dd | |
parent | 994bf03b74672d3a8602e7dc1b73de1fd97830a3 (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>
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 9 |
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); } |