Skip to content

Add compiler suggestion for wrong character escape #24262

Closed
@contradictioned

Description

@contradictioned

When you try to escape a { in a format string, e.g.

format!("\{foo:{} \}", 42)

the compiler complains about the unknown character escape {.
The correct escape syntax would be to use {{ instead of \{, the compiler should suggest this to the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions