-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
fn main() {
println!("Hello, world! {0:}<3", 2);
}
Current output
Compiling playground v0.0.1 (/playground)
error: invalid format string: expected `'}'` but string was terminated
--> src/main.rs:2:35
|
2 | println!("Hello, world! {0:}<3", 2);
| - ^ expected `'}'` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: could not compile `playground` (bin "playground") due to previous error
Desired output
The error should mention that the closing curly brace `}` is interpreted as the fill character and suggest the removal of the colon to fix the issue.
Rationale and extra context
The format spec allows fill to be any character including }
, this may be confusing.
Other cases
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.