]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #45711 - tirr-c:unicode-span, r=estebank
authorbors <bors@rust-lang.org>
Sat, 4 Nov 2017 23:09:19 +0000 (23:09 +0000)
committerbors <bors@rust-lang.org>
Sat, 4 Nov 2017 23:09:19 +0000 (23:09 +0000)
Display spans correctly when there are zero-width or wide characters

Hopefully...
* fixes #45211
* fixes #8706

---

Before:
```
error: invalid width `7` for integer literal
  --> unicode_2.rs:12:25
   |
12 |     let _ = ("a̐éö̲", 0u7);
   |                         ^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: invalid width `42` for integer literal
  --> unicode_2.rs:13:20
   |
13 |     let _ = ("아あ", 1i42);
   |                    ^^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: aborting due to 2 previous errors
```

After:
```
error: invalid width `7` for integer literal
  --> unicode_2.rs:12:25
   |
12 |     let _ = ("a̐éö̲", 0u7);
   |                     ^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: invalid width `42` for integer literal
  --> unicode_2.rs:13:20
   |
13 |     let _ = ("아あ", 1i42);
   |                      ^^^^
   |
   = help: valid widths are 8, 16, 32, 64 and 128

error: aborting due to 2 previous errors
```

Spans might display incorrectly on the browser.

r? @estebank

1  2 
src/Cargo.lock
src/librustc_errors/emitter.rs
src/librustc_metadata/decoder.rs

diff --cc src/Cargo.lock
Simple merge
index 011be74ee7c453d2acc05507f37509cd39583f00,7417794db6b8984d8fa316e99400da9b3af2ed42..6c43c60686ee424e2aa458ff70ac6ea212438c21
@@@ -10,9 -10,9 +10,9 @@@
  
  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 {Level, CodeSuggestion, DiagnosticBuilder, SubDiagnostic, CodeMapper, DiagnosticId};
  use RenderSpan::*;
  use snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, StyledString, Style};
  use styled_buffer::StyledBuffer;
Simple merge