If-else value followed by operator parsing error provided only for some operators #91999
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-frontend
Area: Compiler frontend (errors, parsing and HIR)
A-parser
Area: The lexing & parsing of Rust source code to an AST
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
When an if-else block produces a value and this is followed by an operator and this all happens inside a block, this is apparently a parsing error.
When the operator is
+
, the parsing error is pointed out. When the operator is&
, the parsing error is not pointed out.Please provide the parsing error for all operators.
Given the following code: https://play.rust-lang.org/?edition=2021&gist=55a7b19b44fc6010a33338774bef3b11
The current output is:
Ideally the output should look like the output when
+
is used instead of&
:Note the added help line:
parentheses are required to parse this as an expression
This explanation should be included for all operators.
Nightly has the same problem.
Stable: rustc 1.57.0 (f1edd04 2021-11-29)
Nightly: rustc 1.59.0-nightly (c5ecc15 2021-12-15) (from rustc 1.59.0-nightly (404c847 2021-12-14))
The text was updated successfully, but these errors were encountered: