Closed
Description
Code
#[derive(Debug)]
struct Foo(u8, u8);
fn main() {
let f = Foo(1, 2);
println!("{f:?#}");
}
Current output
error: invalid format string: expected `'}'`, found `'#'`
--> src/main.rs:6:19
|
6 | println!("{f:?#}");
| - ^ expected `'}'` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
Desired output
error: invalid format string: expected `'}'`, found `'#'`
--> src/main.rs:6:19
|
6 | println!("{f:?#}");
| ^^ help: the format parameter should be written `#?`
|
= note: if you intended to print `{`, you can escape it using `{{`
Rationale and extra context
It would be helpful to point out to the user that the format parameter should be written the other way.
Other cases
No response
Rust Version
rustc 1.83.0-nightly (d6c8169c1 2024-09-03)
binary: rustc
commit-hash: d6c8169c186ab16a3404cd0d0866674018e8a19e
commit-date: 2024-09-03
host: x86_64-pc-windows-msvc
release: 1.83.0-nightly
LLVM version: 19.1.0
Anything else?
No response