From 118ac688008593276baa6160b186ba23e5a473de Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 12 Sep 2022 15:24:51 +0300 Subject: feat(corp/tvixbolt): use fancy warning formatting Unfortunately the codemap-diagnostic crate doesn't provide a way to get colour control characters written to an arbitrary writer, so this is black & white only, but we can look at this later if we introduce something even fancier. For now it's reasonable. Change-Id: I1c7655cc4b254f77768b5931bc95fa13b3bd7e12 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6533 Reviewed-by: grfn Tested-by: BuildkiteCI --- corp/tvixbolt/src/main.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'corp/tvixbolt/src/main.rs') diff --git a/corp/tvixbolt/src/main.rs b/corp/tvixbolt/src/main.rs index c359eaed63..ee73fce71d 100644 --- a/corp/tvixbolt/src/main.rs +++ b/corp/tvixbolt/src/main.rs @@ -222,7 +222,7 @@ fn eval(trace: bool, code: &str) -> Output { .expect("expression should exist if no errors occured"); let codemap = Rc::new(codemap); - let mut compilation_observer = DisassemblingObserver::new(codemap, &mut out.bytecode); + let mut compilation_observer = DisassemblingObserver::new(codemap.clone(), &mut out.bytecode); let result = tvix_eval::compile( root_expr, @@ -236,10 +236,8 @@ fn eval(trace: bool, code: &str) -> Output { for warning in result.warnings { writeln!( &mut out.warnings, - "warning: {:?} at `{}` [line {}]", - warning.kind, - file.source_slice(warning.span), - file.find_line(warning.span.low()) + 1 + "{}\n", + warning.fancy_format_str(&codemap).trim(), ) .unwrap(); } -- cgit 1.4.1