From 07e03498f26afbf647102d656c90d447f8586820 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 5 Oct 2022 17:01:07 +0300 Subject: feat(tvix/eval): add method for emitting runtime warnings This lets the VM emit warnings when it encounters situations that should only be warned about at runtime. For starters, this is used to pass through compilation warnings that come up when `import` is used. Change-Id: I0c4bc8c534d699999887c430d93629fadfa662c4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6868 Reviewed-by: sterni Tested-by: BuildkiteCI --- tvix/eval/src/eval.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tvix/eval/src/eval.rs') diff --git a/tvix/eval/src/eval.rs b/tvix/eval/src/eval.rs index 4e50b7279c38..5af5f9d7588e 100644 --- a/tvix/eval/src/eval.rs +++ b/tvix/eval/src/eval.rs @@ -115,5 +115,11 @@ pub fn interpret(code: &str, location: Option, options: Options) -> Eva err.fancy_format_stderr(&source); } - result + result.map(|r| { + for warning in r.warnings { + warning.fancy_format_stderr(&source); + } + + r.value + }) } -- cgit 1.4.1