about summary refs log tree commit diff
path: root/tvix/eval/src/errors.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-22T20·48+0300
committertazjin <tazjin@tvl.su>2022-09-01T21·40+0000
commitf7305eed47dea538611d0ae4c3545b646bce3727 (patch)
treea26d850fcfaa1eab4cccb47440539438707737f3 /tvix/eval/src/errors.rs
parent2662376941367d88687b3ebc4e4b941b266cee42 (diff)
refactor(tvix/eval): collect vector of errors in compiler r/4572
Instead of exiting the compiler at the first sight of an error,
skip any erroneous nodes and continue compiling, collecting more
errors along the way.

This paves the way for nicer error reporting in which multiple errors
can be reported at once, avoiding situations in which users are
hunting a fault error-by-error and possibly getting distracted by
less useful output.

Change-Id: I80c9a87272e33a31297167ae2eb2706a46adf15a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6236
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix/eval/src/errors.rs')
-rw-r--r--tvix/eval/src/errors.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/eval/src/errors.rs b/tvix/eval/src/errors.rs
index 01a5e81449..fd3fddc326 100644
--- a/tvix/eval/src/errors.rs
+++ b/tvix/eval/src/errors.rs
@@ -1,6 +1,6 @@
 use std::fmt::Display;
 
-#[derive(Debug)]
+#[derive(Clone, Debug)]
 pub enum ErrorKind {
     DuplicateAttrsKey {
         key: String,
@@ -27,7 +27,7 @@ pub enum ErrorKind {
     DynamicKeyInLet(rnix::SyntaxNode),
 
     // Unknown variable in statically known scope.
-    UnknownStaticVariable(rnix::ast::Ident),
+    UnknownStaticVariable,
 
     // Unknown variable in dynamic scope (with, rec, ...).
     UnknownDynamicVariable(String),
@@ -37,7 +37,7 @@ pub enum ErrorKind {
     AssertionFailed,
 }
 
-#[derive(Debug)]
+#[derive(Clone, Debug)]
 pub struct Error {
     pub node: Option<rnix::SyntaxNode>,
     pub kind: ErrorKind,