about summary refs log tree commit diff
path: root/tvix/eval/src/vm.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-10T14·53+0300
committertazjin <tazjin@tvl.su>2022-08-24T18·19+0000
commit6dc9ca5723ee46ade3ad3618ae780ec88ae884e2 (patch)
tree9bdf55af081c9dd0f9f59739b4455534f7cad39c /tvix/eval/src/vm.rs
parentc7ba2dec04c9c0bf7558285ed7d434e61ee5e5b5 (diff)
feat(tvix/value): introduce string representation with &'static str r/4457
For cases where the strings are statically known (such as the
oft-occuring name/value), this can be a useful optimisation.

It's also much more convenient in tests.

Change-Id: Ie462b684805bd4986ea5e85ca4bff663bc2d3c3c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6111
Tested-by: BuildkiteCI
Reviewed-by: eta <tvl@eta.st>
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r--tvix/eval/src/vm.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index a58d77cc2720..a529c5a799f7 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -7,7 +7,7 @@ use crate::{
     chunk::Chunk,
     errors::{Error, EvalResult},
     opcode::OpCode,
-    value::{NixAttrs, NixList, NixString, Value},
+    value::{NixAttrs, NixList, Value},
 };
 
 pub struct VM {
@@ -159,10 +159,10 @@ impl VM {
         let mut out = String::new();
 
         for _ in 0..count {
-            out.push_str(&self.pop().as_string()?.0);
+            out.push_str(&self.pop().as_string()?.as_str());
         }
 
-        self.push(Value::String(NixString(out)));
+        self.push(Value::String(out.into()));
         Ok(())
     }