Skip to content

Invalid diagnostic for 'extra required argument' for explicit numbered precision argument. #100995

Closed
@m-ou-se

Description

@m-ou-se
error: 2 positional arguments in format string, but no arguments were given
 --> src/main.rs:2:14
  |
2 |     format!("{:.0$}");
  |              ^^---^
  |                |
  |                this precision flag adds an extra required argument at position 0, which is why there are 2 arguments expected
  |

It says there are two arguments expected, but that's not true. This only needs one argument.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-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