diff options
| author | Xavier Denis <xldenis@gmail.com> | 2019-04-16 19:26:41 -0300 |
|---|---|---|
| committer | Xavier Denis <xldenis@gmail.com> | 2019-04-22 18:14:45 -0500 |
| commit | 4a073dda936b2bc594056dca43c3ea51479435fe (patch) | |
| tree | 60e7cad4f0cde0bab0be1a4b9c89beb4f25eb9b9 /src/librustc_errors | |
| parent | c21fbfe7e310b9055ed6b7c46b7d37b831a516e3 (diff) | |
| download | rust-4a073dda936b2bc594056dca43c3ea51479435fe.tar.gz rust-4a073dda936b2bc594056dca43c3ea51479435fe.zip | |
Fix #58270, fix off-by-one error in error diagnostics.
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index a1472479afa..c3d594204f4 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -268,6 +268,7 @@ impl EmitterWriter { // 6..7. This is degenerate input, but it's best to degrade // gracefully -- and the parser likes to supply a span like // that for EOF, in particular. + if lo.col_display == hi.col_display && lo.line == hi.line { hi.col_display += 1; } @@ -547,6 +548,15 @@ impl EmitterWriter { && j > i // multiline lines). && p == 0 // We're currently on the first line, move the label one line down { + // If we're overlapping with an un-labelled annotation with the same span + // we can just merge them in the output + if next.start_col == annotation.start_col + && next.end_col == annotation.end_col + && !next.has_label() + { + continue; + } + // This annotation needs a new line in the output. p += 1; break; |
