-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Given the following code:
fn main() {
let x = +1;
}
The current output is:
error: expected expression, found `+`
--> src/main.rs:2:13
|
2 | let x = +1;
| ^ expected expression
Ideally, if we want to continue rejecting unary plus on number literals, the parser should recover the unexpected unary plus, and the output should look somewhat like:
error: leading `+` on numeric literals is not supported
--> src/main.rs:2:13
|
2 | let x = +1;
| ^ unexpected `+`
= help: remove it; the unsigned literal is positive and may still be used for a signed type
Tested on 1.56.0-nightly (2021-08-22 af14075)
leonardo-m
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.