Skip to content

Confusing error message if you forget the width of the * format specifier #49384

Closed
@alercah

Description

@alercah

Playground link: https://play.rust-lang.org/?gist=fea3e7d4c4151751bb66b69ba906ea88&version=stable

If the * formatting specifier is used, it expects an additional argument. But it does not account for this when printing an error message, so in the above example where an argument was forgotten, the error is "error: 1 positional argument in format string, but there is 1 argument". It should indicate that there are in fact 2 positional arguments in the format string, due to *.

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.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