about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorChristoph Schmidler <c.schmidler@gmail.com>2019-11-20 23:17:30 +0100
committerChristoph Schmidler <c.schmidler@gmail.com>2019-11-27 20:02:20 +0100
commit59d73912387724933511c32306da038db545ea66 (patch)
treee9925dd5139ad842167f3705e71f326072861247 /src/librustc_errors
parent04e69e4f4234beb4f12cc76dcc53e2cc4247a9be (diff)
downloadrust-59d73912387724933511c32306da038db545ea66.tar.gz
rust-59d73912387724933511c32306da038db545ea66.zip
Draw vertical lines in compiler error messages with multiline annotations correctly when non-1space unicode characters are to the left
For this we use the correct calculation of the 'left' identation
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/emitter.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index ea779982ba9..45191375748 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -835,7 +835,7 @@ impl EmitterWriter {
             return vec![];
         }
 
-        // Write the colunmn separator.
+        // Write the column separator.
         //
         // After this we will have:
         //
@@ -906,7 +906,7 @@ impl EmitterWriter {
         //   |  __________
         //   | |    |
         //   | |
-        // 3 |
+        // 3 | |
         // 4 | | }
         //   | |_
         for &(pos, annotation) in &annotations_position {
@@ -920,7 +920,7 @@ impl EmitterWriter {
             if pos > 1 && (annotation.has_label() || annotation.takes_space()) {
                 for p in line_offset + 1..=line_offset + pos {
                     buffer.putc(p,
-                                code_offset + annotation.start_col - margin.computed_left,
+                                (code_offset + annotation.start_col).saturating_sub(left),
                                 '|',
                                 style);
                 }