Rust: correct line and column numbers in printed error messages

This commit is contained in:
Arthur Baars
2024-09-24 11:11:48 +02:00
parent ca2b8ef6c0
commit 37f264df74

View File

@@ -84,7 +84,7 @@ impl Translator {
}
pub fn emit_parse_error(&mut self, path: &str, err: SyntaxError) {
let (start, end) = self.location(err.range());
log::warn!("{}:{}:{}: {}", path, start.line, start.col, err);
log::warn!("{}:{}:{}: {}", path, start.line + 1, start.col + 1, err);
let message = err.to_string();
let location = self.trap.emit_location_label(self.label, start, end);
self.trap.emit_diagnostic(