diff options
author | Vincent Ambo <mail@tazj.in> | 2021-02-27T12·17+0200 |
---|---|---|
committer | tazjin <mail@tazj.in> | 2021-02-27T13·05+0000 |
commit | da2dfb42c6c1cb3a63686be06e9ff04f445506b2 (patch) | |
tree | 435267a7bd36df5fa828feedd19c03d3ede0250a /users/tazjin/rlox/src/bytecode | |
parent | 75750ba6835ae8ac3a97c24ca7ff5ebc1500f36d (diff) |
chore(tazjin/rlox): Add From<Error> for Vec<Error> r/2236
This makes it easier to transition between the single/multi error functions via ? Change-Id: Ie027f4700da463a549be6f0d4a0022a9b8dc0d61 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2555 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'users/tazjin/rlox/src/bytecode')
-rw-r--r-- | users/tazjin/rlox/src/bytecode/errors.rs | 8 |
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>; |