From ae0a56cdffa515ed6bb7cb566c025cc66ff00f33 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 15 Mar 2022 11:30:13 +0100 Subject: Non-returning error macro --- src/eval/control.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/eval/control.rs') diff --git a/src/eval/control.rs b/src/eval/control.rs index b310bfb8..166676d4 100644 --- a/src/eval/control.rs +++ b/src/eval/control.rs @@ -1,5 +1,5 @@ use super::{ops, EvalResult, Value}; -use crate::diag::{At, Error, TypError}; +use crate::diag::{At, TypError}; use crate::syntax::Span; /// A control flow event that occurred during evaluation. @@ -25,12 +25,14 @@ impl From for Control { impl From for TypError { fn from(control: Control) -> Self { match control { - Control::Break(_, span) => Error::boxed(span, "cannot break outside of loop"), + Control::Break(_, span) => { + error!(span, "cannot break outside of loop") + } Control::Continue(_, span) => { - Error::boxed(span, "cannot continue outside of loop") + error!(span, "cannot continue outside of loop") } Control::Return(_, _, span) => { - Error::boxed(span, "cannot return outside of function") + error!(span, "cannot return outside of function") } Control::Err(e) => e, } -- cgit v1.2.3