Skip to content

Diagnostics' ^~~~ is not aligned properly when error contains 日本語 characters #21492

Closed
@ghost

Description

Note the misaligned ^~~~~~~ below due to the 日本語 characters(their length is not computed properly?):

$ rustc -v main.rs 
main.rs:3:38: 3:43 error: unresolved name `hello`
main.rs:3     println!("Hello in English: {}", hello());
                                               ^~~~~
note: in expansion of format_args!
<std macros>:2:42: 2:75 note: expansion site
<std macros>:1:1: 2:77 note: in expansion of println!
main.rs:3:5: 3:47 note: expansion site
main.rs:4:46: 4:53 error: unresolved name `goodbye`
main.rs:4     println!("Goodbye in Japanese(日本語): {}", goodbye());
                                                       ^~~~~~~
note: in expansion of format_args!
<std macros>:2:42: 2:75 note: expansion site
<std macros>:1:1: 2:77 note: in expansion of println!
main.rs:4:5: 4:57 note: expansion site
error: aborting due to 2 previous errors

main.rs is this(compiled with rustc -v main.rs):

fn main() {
    println!("Hello in English: {}", hello());
    println!("Goodbye in Japanese(日本語): {}", goodbye());
}
$ rustc --version --verbose
rustc 1.0.0-dev (3bf41dafc 2015-01-20 06:45:02 +0000)
binary: rustc
commit-hash: 3bf41dafcfb6c979efb4e2438e047e1a54045eec
commit-date: 2015-01-20 06:45:02 +0000
host: x86_64-unknown-linux-gnu
release: 1.0.0-dev

tested in urxvt and xfce4-terminal (TERM is rxvt-unicode-256color respectively xterm)
Linux 3.19.0-rc5-gec6f34e

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions