mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
make JSON error byte position start at top of file
The `hi` and `lo` offsets in a span are relative to a `CodeMap`, but this doesn't seem to be terribly useful for tool consumers who don't have the codemap, but might want the byte offset within an actual file? Resolves #35164.
This commit is contained in:
parent
15aa15b03f
commit
6043ce9f75
@ -256,8 +256,8 @@ impl DiagnosticSpan {
|
||||
});
|
||||
DiagnosticSpan {
|
||||
file_name: start.file.name.clone(),
|
||||
byte_start: span.lo.0,
|
||||
byte_end: span.hi.0,
|
||||
byte_start: span.lo.0 - start.file.start_pos.0,
|
||||
byte_end: span.hi.0 - start.file.start_pos.0,
|
||||
line_start: start.line,
|
||||
line_end: end.line,
|
||||
column_start: start.col.0 + 1,
|
||||
@ -362,4 +362,3 @@ impl JsonEmitter {
|
||||
suggestion.splice_lines(&*self.cm).iter().map(|line| line.0.to_owned()).collect()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user