format! parse error expectations are sometimes inaccurate #57277
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-parser
Area: The lexing & parsing of Rust source code to an AST
See #56897 (comment).
The
format!
macro claims that it expects,
when failing to parse a format string argument, but it actually accepts all tokens that make up expressions in that position. The simplest fix would be to useexpect(&token::Comma)
, but that causes parsing errors directly after the format string to claim that expression tokens are expected in that position are accepted, when they are not.In other words, it would be nice to get diagnostics like this:
while avoiding getting diagnostics like this:
The text was updated successfully, but these errors were encountered: