about summary refs log tree commit diff
path: root/tvix/eval/src/value
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-26T15·35+0300
committertazjin <tazjin@tvl.su>2022-09-03T00·49+0000
commitbc9351f811a9394898d0c9ab4da193e320c27bdd (patch)
treeb878faae89bc5eb46ace89a74ba8883f89cde129 /tvix/eval/src/value
parentd761d934ed341fe161d5091aecf87c52d3874256 (diff)
refactor(tvix/eval): get rid of Value::Blackhole variant r/4611
This is no longer needed for anything and the extra clone here is not
really more costly than constructing a blackhole value in a different
place.

Change-Id: I5c63085b1b4418b629ea58a42e3bfe9a9b586d76
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6275
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/value')
-rw-r--r--tvix/eval/src/value/attrs.rs4
-rw-r--r--tvix/eval/src/value/mod.rs4
2 files changed, 3 insertions, 5 deletions
diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs
index 51f741a210a1..74f1bd4481b2 100644
--- a/tvix/eval/src/value/attrs.rs
+++ b/tvix/eval/src/value/attrs.rs
@@ -315,8 +315,8 @@ fn attempt_optimise_kv(slice: &mut [Value]) -> Option<NixAttrs> {
     };
 
     Some(NixAttrs(AttrsRep::KV {
-        name: std::mem::replace(&mut slice[name_idx], Value::Blackhole),
-        value: std::mem::replace(&mut slice[value_idx], Value::Blackhole),
+        name: slice[name_idx].clone(),
+        value: slice[value_idx].clone(),
     }))
 }
 
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs
index 6bd1efde52ff..3db6a00e4df6 100644
--- a/tvix/eval/src/value/mod.rs
+++ b/tvix/eval/src/value/mod.rs
@@ -33,7 +33,6 @@ pub enum Value {
     // Internal values that, while they technically exist at runtime,
     // are never returned to or created directly by users.
     AttrPath(Vec<NixString>),
-    Blackhole,
     NotFound,
 }
 
@@ -55,7 +54,7 @@ impl Value {
             Value::Closure(_) | Value::Builtin(_) => "lambda",
 
             // Internal types
-            Value::AttrPath(_) | Value::Blackhole | Value::NotFound => "internal",
+            Value::AttrPath(_) | Value::NotFound => "internal",
         }
     }
 
@@ -141,7 +140,6 @@ impl Display for Value {
 
             // internal types
             Value::AttrPath(path) => write!(f, "internal[attrpath({})]", path.len()),
-            Value::Blackhole => f.write_str("internal[blackhole]"),
             Value::NotFound => f.write_str("internal[not found]"),
         }
     }