about summary refs log tree commit diff
path: root/tvix/eval/src/vm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r--tvix/eval/src/vm.rs24
1 files changed, 15 insertions, 9 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index 252635de56d0..05adec5f6ea6 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -524,14 +524,17 @@ impl<'o> VM<'o> {
                 self.push(Value::String(string));
             }
 
-            OpCode::OpFindFile => {
-                let path = self.pop().to_str().map_err(|e| self.error(e))?;
-                let resolved = self
-                    .nix_search_path
-                    .resolve(path)
-                    .map_err(|e| self.error(e))?;
-                self.push(resolved.into());
-            }
+            OpCode::OpFindFile => match self.pop() {
+                Value::UnresolvedPath(path) => {
+                    let resolved = self
+                        .nix_search_path
+                        .resolve(path)
+                        .map_err(|e| self.error(e))?;
+                    self.push(resolved.into());
+                }
+
+                _ => panic!("tvix compiler bug: OpFindFile called on non-UnresolvedPath"),
+            },
 
             OpCode::OpJump(JumpOffset(offset)) => {
                 debug_assert!(offset != 0);
@@ -836,7 +839,10 @@ impl<'o> VM<'o> {
 
             // If any of these internal values are encountered here a
             // critical error has happened (likely a compiler bug).
-            Value::AttrNotFound | Value::Blueprint(_) | Value::DeferredUpvalue(_) => {
+            Value::AttrNotFound
+            | Value::Blueprint(_)
+            | Value::DeferredUpvalue(_)
+            | Value::UnresolvedPath(_) => {
                 panic!("tvix bug: internal value left on stack: {:?}", value)
             }