diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-13 12:21:14 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-13 14:33:58 +0200 |
| commit | 144f20882136ef81b79d77bd8a68f42b76c66676 (patch) | |
| tree | 7a452ab2a092f674d93cd994d80b88cc6808e540 /src/main.rs | |
| parent | d002cdf451e1c6efbf7cd7f2303264526b6f8a92 (diff) | |
Add file information to spans
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index f3a97d51..9fa89e42 100644 --- a/src/main.rs +++ b/src/main.rs @@ -113,15 +113,15 @@ fn print_diagnostics( for error in errors { // The main diagnostic. - let main = Diagnostic::error() - .with_message(error.message) - .with_labels(vec![Label::primary(error.source, error.span.to_range())]); + let main = Diagnostic::error().with_message(error.message).with_labels(vec![ + Label::primary(error.span.source, error.span.to_range()), + ]); term::emit(&mut writer, &config, sources, &main)?; // Stacktrace-like helper diagnostics. - for (file, span, point) in error.trace { - let message = match point { + for point in error.trace { + let message = match point.v { Tracepoint::Call(Some(name)) => { format!("error occured in this call of function `{}`", name) } @@ -129,9 +129,9 @@ fn print_diagnostics( Tracepoint::Import => "error occured while importing this module".into(), }; - let help = Diagnostic::help() - .with_message(message) - .with_labels(vec![Label::primary(file, span.to_range())]); + let help = Diagnostic::help().with_message(message).with_labels(vec![ + Label::primary(point.span.source, point.span.to_range()), + ]); term::emit(&mut writer, &config, sources, &help)?; } |
