rust/tests/ui/parser/issues/issue-66473.stderr
Esteban Küber 2d7795dfb9 Be more accurate about calculating display_col from a BytePos
No longer track "zero-width" chars in `SourceMap`, read directly from the line when calculating the `display_col` of a `BytePos`. Move `char_width` to `rustc_span` and use it from the emitter.

This change allows the following to properly align in terminals (depending on the font, the replaced control codepoints are rendered as 1 or 2 width, on my terminal they are rendered as 1, on VSCode text they are rendered as 2):

```
error: this file contains an unclosed delimiter
  --> $DIR/issue-68629.rs:5:17
   |
LL | ␜␟ts␀![{i
   |       -- unclosed delimiter
   |       |
   |       unclosed delimiter
LL | ␀␀  fn rݻoa>rݻm
   |                ^
```
2024-07-18 20:08:38 +00:00

47 lines
1.2 KiB
Plaintext

error: unknown start of token: \u{348}
--> $DIR/issue-66473.rs:4:2
|
LL | #͈␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀
| ^
error: unknown start of token: \u{0}
--> $DIR/issue-66473.rs:4:3
|
LL | #͈␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀
| ^^^^^^^^^^^^^^^^^^
|
= help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
= note: character appears 17 more times
error: unknown start of token: \u{1d}
--> $DIR/issue-66473.rs:5:2
|
LL | ␋␝6␝␀␀
| ^
error: unknown start of token: \u{1d}
--> $DIR/issue-66473.rs:5:4
|
LL | ␋␝6␝␀␀
| ^
error: unknown start of token: \u{0}
--> $DIR/issue-66473.rs:5:5
|
LL | ␋␝6␝␀␀
| ^^
|
= help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
= note: character appears once more
error: expected one of `!` or `[`, found `6`
--> $DIR/issue-66473.rs:5:3
|
LL | #͈␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀
| - expected one of `!` or `[`
LL | ␋␝6␝␀␀
| ^ unexpected token
error: aborting due to 6 previous errors