bad diagnostic suggestion for self access in a format string #105520
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-fmt
Area: `core::fmt`
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
A-resolve
Area: Name/path resolution done by `rustc_resolve` specifically
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code:
The current output is:
Applying the suggestion doesn't work since format strings don't allow non-identifier expressions. Fortunately applying the suggestion and compiling again will lead to another suggestion with the correct syntax. Ideally the original diagnostic should provide the correct syntax of
format!("{}", self.value)
The text was updated successfully, but these errors were encountered: