about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-10-25T20·07-0700
committerclbot <clbot@tvl.fyi>2022-10-28T10·16+0000
commit3aec6786798d6ffd5e5eb5b205827b92b6185f1d (patch)
treecd730da42db6c89ad81543efd63c060ed1a25ddf /tvix/eval
parenta79bbad03b370e362e72a8ea616627c2aebd6d48 (diff)
docs(tvix/eval): warn that AttrsRep::KV is not for Key-Value pairs r/5218
I assumed that AttrsRep::KV represented attrsets with a single
attribute as a Key-Value pair.  That is not the case.  Let's warn
other people about this.

Signed-off-by: Adam Joseph <adam@westernsemico.com>
Change-Id: Ie3d2765fcc1ab705c153ab94ffe77bbd6d4ab39e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7093
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/src/value/attrs.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs
index c0f82b921449..ca4d17178a5e 100644
--- a/tvix/eval/src/value/attrs.rs
+++ b/tvix/eval/src/value/attrs.rs
@@ -23,7 +23,14 @@ mod tests;
 enum AttrsRep {
     Empty,
     Map(BTreeMap<NixString, Value>),
-    KV { name: Value, value: Value },
+
+    /// Warning: this represents a **two**-attribute attrset, with
+    /// attribute names "name" and "value", like `{name="foo";
+    /// value="bar";}`, *not* `{foo="bar";}`!
+    KV {
+        name: Value,
+        value: Value,
+    },
 }
 
 impl AttrsRep {