Use verbose suggestions and only match if the + is seen before a numeric literal
This commit is contained in:
parent
bc9877c5af
commit
65eb7e516c
9 changed files with 58 additions and 95 deletions
|
|
@ -2,10 +2,13 @@ error: leading `+` is not supported
|
|||
--> $DIR/issue-36499.rs:4:9
|
||||
|
|
||||
LL | 2 + +2;
|
||||
| ^
|
||||
| |
|
||||
| unexpected `+`
|
||||
| help: try removing the `+`
|
||||
| ^ unexpected `+`
|
||||
|
|
||||
help: try removing the `+`
|
||||
|
|
||||
LL - 2 + +2;
|
||||
LL + 2 + 2;
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![allow(unused_must_use)]
|
||||
|
||||
fn foo() -> i32 {
|
||||
({2}) + {2} //~ ERROR leading `+` is not supported
|
||||
({2}) + {2} //~ ERROR expected expression, found `+`
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ fn bar() -> i32 {
|
|||
|
||||
fn zul() -> u32 {
|
||||
let foo = 3;
|
||||
({ 42 }) + foo; //~ ERROR leading `+` is not supported
|
||||
({ 42 }) + foo; //~ ERROR expected expression, found `+`
|
||||
//~^ ERROR mismatched types
|
||||
32
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#![allow(unused_must_use)]
|
||||
|
||||
fn foo() -> i32 {
|
||||
{2} + {2} //~ ERROR leading `+` is not supported
|
||||
{2} + {2} //~ ERROR expected expression, found `+`
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ fn bar() -> i32 {
|
|||
|
||||
fn zul() -> u32 {
|
||||
let foo = 3;
|
||||
{ 42 } + foo; //~ ERROR leading `+` is not supported
|
||||
{ 42 } + foo; //~ ERROR expected expression, found `+`
|
||||
//~^ ERROR mismatched types
|
||||
32
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
error: leading `+` is not supported
|
||||
error: expected expression, found `+`
|
||||
--> $DIR/expr-as-stmt.rs:8:9
|
||||
|
|
||||
LL | {2} + {2}
|
||||
| ^ unexpected `+`
|
||||
| ^ expected expression
|
||||
|
|
||||
help: parentheses are required to parse this as an expression
|
||||
|
|
||||
|
|
@ -20,11 +20,11 @@ help: parentheses are required to parse this as an expression
|
|||
LL | ({2}) + 2
|
||||
| + +
|
||||
|
||||
error: leading `+` is not supported
|
||||
error: expected expression, found `+`
|
||||
--> $DIR/expr-as-stmt.rs:19:12
|
||||
|
|
||||
LL | { 42 } + foo;
|
||||
| ^ unexpected `+`
|
||||
| ^ expected expression
|
||||
|
|
||||
help: parentheses are required to parse this as an expression
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,12 +2,7 @@
|
|||
#[allow(unused_parens)]
|
||||
fn main() {
|
||||
let _ = 1; //~ ERROR leading `+` is not supported
|
||||
let _ = -(1+2)*3; //~ ERROR leading `+` is not supported
|
||||
let _ = --(1+2)*3; //~ ERROR leading `+` is not supported
|
||||
//~| ERROR leading `+` is not supported
|
||||
let _ = (1 + 2) * 3; //~ ERROR leading `+` is not supported
|
||||
let _ = (1.0 + 2.0) * 3.0; //~ ERROR leading `+` is not supported
|
||||
//~| ERROR leading `+` is not supported
|
||||
let _ = (&"hello"); //~ ERROR leading `+` is not supported
|
||||
let _ = [3, 4+6]; //~ ERROR leading `+` is not supported
|
||||
//~| ERROR leading `+` is not supported
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,7 @@
|
|||
#[allow(unused_parens)]
|
||||
fn main() {
|
||||
let _ = +1; //~ ERROR leading `+` is not supported
|
||||
let _ = -+(1+2)*3; //~ ERROR leading `+` is not supported
|
||||
let _ = -+-+(1+2)*3; //~ ERROR leading `+` is not supported
|
||||
//~| ERROR leading `+` is not supported
|
||||
let _ = (1 + +2) * +3; //~ ERROR leading `+` is not supported
|
||||
let _ = (1.0 + +2.0) * +3.0; //~ ERROR leading `+` is not supported
|
||||
//~| ERROR leading `+` is not supported
|
||||
let _ = (+&"hello"); //~ ERROR leading `+` is not supported
|
||||
let _ = +[+3, 4+6]; //~ ERROR leading `+` is not supported
|
||||
//~| ERROR leading `+` is not supported
|
||||
let _ = [+3, 4+6]; //~ ERROR leading `+` is not supported
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,82 +2,49 @@ error: leading `+` is not supported
|
|||
--> $DIR/issue-88276-unary-plus.rs:4:13
|
||||
|
|
||||
LL | let _ = +1;
|
||||
| ^
|
||||
| |
|
||||
| unexpected `+`
|
||||
| help: try removing the `+`
|
||||
| ^ unexpected `+`
|
||||
|
|
||||
help: try removing the `+`
|
||||
|
|
||||
LL - let _ = +1;
|
||||
LL + let _ = 1;
|
||||
|
|
||||
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:5:14
|
||||
--> $DIR/issue-88276-unary-plus.rs:5:20
|
||||
|
|
||||
LL | let _ = -+(1+2)*3;
|
||||
| ^
|
||||
| |
|
||||
| unexpected `+`
|
||||
| help: try removing the `+`
|
||||
LL | let _ = (1.0 + +2.0) * +3.0;
|
||||
| ^ unexpected `+`
|
||||
|
|
||||
help: try removing the `+`
|
||||
|
|
||||
LL - let _ = (1.0 + +2.0) * +3.0;
|
||||
LL + let _ = (1.0 + 2.0) * +3.0;
|
||||
|
|
||||
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:6:14
|
||||
--> $DIR/issue-88276-unary-plus.rs:5:28
|
||||
|
|
||||
LL | let _ = -+-+(1+2)*3;
|
||||
| ^
|
||||
| |
|
||||
| unexpected `+`
|
||||
| help: try removing the `+`
|
||||
LL | let _ = (1.0 + +2.0) * +3.0;
|
||||
| ^ unexpected `+`
|
||||
|
|
||||
help: try removing the `+`
|
||||
|
|
||||
LL - let _ = (1.0 + +2.0) * +3.0;
|
||||
LL + let _ = (1.0 + +2.0) * 3.0;
|
||||
|
|
||||
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:6:16
|
||||
--> $DIR/issue-88276-unary-plus.rs:7:14
|
||||
|
|
||||
LL | let _ = -+-+(1+2)*3;
|
||||
| ^
|
||||
| |
|
||||
| unexpected `+`
|
||||
| help: try removing the `+`
|
||||
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:8:18
|
||||
LL | let _ = [+3, 4+6];
|
||||
| ^ unexpected `+`
|
||||
|
|
||||
LL | let _ = (1 + +2) * +3;
|
||||
| ^
|
||||
| |
|
||||
| unexpected `+`
|
||||
| help: try removing the `+`
|
||||
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:8:24
|
||||
help: try removing the `+`
|
||||
|
|
||||
LL | let _ = (1 + +2) * +3;
|
||||
| ^
|
||||
| |
|
||||
| unexpected `+`
|
||||
| help: try removing the `+`
|
||||
LL - let _ = [+3, 4+6];
|
||||
LL + let _ = [3, 4+6];
|
||||
|
|
||||
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:10:14
|
||||
|
|
||||
LL | let _ = (+&"hello");
|
||||
| ^
|
||||
| |
|
||||
| unexpected `+`
|
||||
| help: try removing the `+`
|
||||
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:11:13
|
||||
|
|
||||
LL | let _ = +[+3, 4+6];
|
||||
| ^
|
||||
| |
|
||||
| unexpected `+`
|
||||
| help: try removing the `+`
|
||||
|
||||
error: leading `+` is not supported
|
||||
--> $DIR/issue-88276-unary-plus.rs:11:15
|
||||
|
|
||||
LL | let _ = +[+3, 4+6];
|
||||
| ^
|
||||
| |
|
||||
| unexpected `+`
|
||||
| help: try removing the `+`
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue