Skip to content

Incorrect underline when format strings contain escaped characters #55155

Closed
@martin-t

Description

@martin-t

Playground

Output:

error: 1 positional argument in format string, but no arguments were given
 --> src/main.rs:2:16
  |
2 |     println!("\t{}");
  |                ^^

It seems the underline offset doesn't take into account that some characters like "\n\t\r" are wider in the source code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions