format!
should be able to parse arbitrary inline expressions and provide a targeted error
#96999
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-parser
Area: The lexing & parsing of Rust source code to an AST
D-papercut
Diagnostics: An error or lint that needs small tweaks.
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
format!
currently doesn't support inline expressions, likeformat!("{binding.field}");
, but the error it emits while serviceable isn't great:It would be much better experience if we started parsing first field access expressions, potentially method calls and later arbitrary expressions and explicitly told the user "you can't do that, move the expression to its own binding". If we were to ever attempt to support this, prototyping the machinery for diagnostics first would also be informative about its limits or potential problems.
The text was updated successfully, but these errors were encountered: