about summary refs log tree commit diff
path: root/tvix/cli/src/main.rs
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2024-07-07T13·21-0400
committerclbot <clbot@tvl.fyi>2024-07-07T15·04+0000
commit8821746d6c6c1b71774727fe1103425d903952bb (patch)
treea2df882d90b9d0de9ce3ff61ce6eafa75411a12a /tvix/cli/src/main.rs
parent01765c3717579dc985f4b6c15a5b0b2fcf1dc4da (diff)
fix(tvix/repl): Share globals and sourcemap across evaluations r/8355
Now that we can bind (potentially lazy, potentially lambda-containing)
values in the REPL and then reference them in subsequent evaluations,
it's important that the values to which we construct shared references
are shared across those subsequent evaluations - otherwise, we get
panics due to unknown source map locations, or dropped weak references
to globals.

This change assigns both the globals and the source map as fields on the
Repl after the first evaluation, and then passes those in (to the
EvaluationBuilder) on subsequent evaluations.

On the EvaluationBuilder side, there's some panicking introduced - this
is intentional, as my intent is for the builder to be configured
statically enough that panicking is the best way to report errors
here (it's always a bug to misconfigure an Evaluation, and we'd never
want to handle it dynamically).

Change-Id: I37225697235c22b683ca48a17d30fa8fedd12d1b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11960
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/cli/src/main.rs')
-rw-r--r--tvix/cli/src/main.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs
index 0bd3be37eeb2..f927665aeb76 100644
--- a/tvix/cli/src/main.rs
+++ b/tvix/cli/src/main.rs
@@ -75,6 +75,8 @@ fn main() {
             false,
             AllowIncomplete::RequireComplete,
             None, // TODO(aspen): Pass in --arg/--argstr here
+            None,
+            None,
         )
         .unwrap()
         .finalize()
@@ -104,6 +106,8 @@ fn run_file(io_handle: Rc<TvixStoreIO>, mut path: PathBuf, args: &Args) {
             false,
             AllowIncomplete::RequireComplete,
             None,
+            None,
+            None,
         )
         .unwrap()
         .finalize()