Closed
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