Skip to content

Unclear error message when using . in format string #122535

Closed
@Alon0709

Description

@Alon0709

I tried this code:

    let x = (1, 2, 3);
    println!("{x.0}",);

I expected to see this happen: printing of the value 1.

Instead, this happened: it gave the following error:

invalid format string: expected '}', found '.'
if you intended to print {, you can escape it using {{rustcClick for full compiler diagnostic

Meta

rustc --version --verbose:

1.76.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsD-papercutDiagnostics: An error or lint that needs small tweaks.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