diff options
| author | Wonwoo Choi <chwo9843@gmail.com> | 2017-11-02 10:25:54 +0900 |
|---|---|---|
| committer | Wonwoo Choi <chwo9843@gmail.com> | 2017-11-03 03:15:39 +0900 |
| commit | 272c2faa1d766fd4185141106959cdb58b88e6e9 (patch) | |
| tree | 2871d83d8d22fb2f83259d6c836fcad23205fae4 /src/librustc_errors | |
| parent | 2be4cc040211a85b17f21e813ff62351ae4de642 (diff) | |
Display spans correctly when there are non-half-width characters
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 5db5a9a1133..7417794db6b 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -10,7 +10,7 @@ use self::Destination::*; -use syntax_pos::{DUMMY_SP, FileMap, Span, MultiSpan, CharPos}; +use syntax_pos::{DUMMY_SP, FileMap, Span, MultiSpan}; use {Level, CodeSuggestion, DiagnosticBuilder, SubDiagnostic, CodeMapper}; use RenderSpan::*; @@ -201,8 +201,8 @@ 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 == hi.col && lo.line == hi.line { - hi.col = CharPos(lo.col.0 + 1); + if lo.col_display == hi.col_display && lo.line == hi.line { + hi.col_display += 1; } let ann_type = if lo.line != hi.line { @@ -210,8 +210,8 @@ impl EmitterWriter { depth: 1, line_start: lo.line, line_end: hi.line, - start_col: lo.col.0, - end_col: hi.col.0, + start_col: lo.col_display, + end_col: hi.col_display, is_primary: span_label.is_primary, label: span_label.label.clone(), }; @@ -221,8 +221,8 @@ impl EmitterWriter { AnnotationType::Singleline }; let ann = Annotation { - start_col: lo.col.0, - end_col: hi.col.0, + start_col: lo.col_display, + end_col: hi.col_display, is_primary: span_label.is_primary, label: span_label.label.clone(), annotation_type: ann_type, |
