about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/bytecode/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/rlox/src/bytecode/errors.rs')
-rw-r--r--users/tazjin/rlox/src/bytecode/errors.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/users/tazjin/rlox/src/bytecode/errors.rs b/users/tazjin/rlox/src/bytecode/errors.rs
index 513708df7e85..99b2aa406c99 100644
--- a/users/tazjin/rlox/src/bytecode/errors.rs
+++ b/users/tazjin/rlox/src/bytecode/errors.rs
@@ -37,4 +37,12 @@ impl From<ScannerError> for Error {
     }
 }
 
+// Convenience implementation as we're often dealing with vectors of
+// errors (to report as many issues as possible before terminating)
+impl From<Error> for Vec<Error> {
+    fn from(err: Error) -> Self {
+        vec![err]
+    }
+}
+
 pub type LoxResult<T> = Result<T, Error>;