about summary refs log tree commit diff
path: root/tvix/eval/src/compiler/import.rs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2024-02-20T08·29+0700
committertazjin <tazjin@tvl.su>2024-02-20T09·18+0000
commit3c87687798a3cfb6c3cfcc231e6c60511e3341ab (patch)
tree90dd1bb7daefbd09cd308240858689c6a405701f /tvix/eval/src/compiler/import.rs
parentb38badf2063b4eba31abffbeba01c1c8c3212be8 (diff)
refactor(tvix/eval): add SourceCode directly into error types r/7571
With this change it's no longer necessary to track the SourceCode
struct separately from the evaluation for error reporting: It's just
stored directly in the errors.

This also ends up resolving an issue in compiler::bindings, where we
cloned the Arc containing file references way too often. In fact those
clones probably compensate for all additional SourceCode clones during
error construction now.

Change-Id: Ice93bf161e61f8ea3d48103435e20c53e6aa8c3a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10986
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/compiler/import.rs')
-rw-r--r--tvix/eval/src/compiler/import.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/tvix/eval/src/compiler/import.rs b/tvix/eval/src/compiler/import.rs
index 6774c7b8922c..c56909e958fb 100644
--- a/tvix/eval/src/compiler/import.rs
+++ b/tvix/eval/src/compiler/import.rs
@@ -58,13 +58,14 @@ async fn import_impl(
     let result = crate::compiler::compile(
         &parsed.tree().expr().unwrap(),
         Some(path.clone()),
-        file,
         // The VM must ensure that a strong reference to the globals outlives
         // any self-references (which are weak) embedded within the globals. If
         // the expect() below panics, it means that did not happen.
         globals
             .upgrade()
             .expect("globals dropped while still in use"),
+        &source,
+        &file,
         &mut NoOpObserver::default(),
     )
     .map_err(|err| ErrorKind::ImportCompilerError {