File tree 3 files changed +11
-18
lines changed
compiler/rustc_parse/src/parser
3 files changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,7 @@ impl<'a> Parser<'a> {
269
269
270
270
if self . prev_token == token:: BinOp ( token:: Plus )
271
271
&& self . token == token:: BinOp ( token:: Plus )
272
+ && self . prev_token . span . between ( self . token . span ) . is_empty ( )
272
273
{
273
274
let op_span = self . prev_token . span . to ( self . token . span ) ;
274
275
// Eat the second `+`
Original file line number Diff line number Diff line change 1
- error: Rust has no postfix increment operator
2
- --> $DIR/issue-36499.rs:4:7
1
+ error: leading `+` is not supported
2
+ --> $DIR/issue-36499.rs:4:9
3
3
|
4
4
LL | 2 + +2;
5
- | ^^^ not a valid postfix operator
5
+ | ^ unexpected `+`
6
6
|
7
- help: use `+= 1` instead
8
- |
9
- LL | { let tmp = 2 ; 2 += 1; tmp }2;
10
- | +++++++++++ ~~~~~~~~~~~~~~~
11
- help: or, if you don't need to use it as an expression, change it to this
7
+ help: try removing the `+`
12
8
|
13
9
LL - 2 + +2;
14
- LL + 2 += 12 ;
10
+ LL + 2 + 2 ;
15
11
|
16
12
17
13
error: aborting due to previous error
Original file line number Diff line number Diff line change @@ -10,20 +10,16 @@ LL - let _ = +1;
10
10
LL + let _ = 1;
11
11
|
12
12
13
- error: Rust has no postfix increment operator
14
- --> $DIR/issue-88276-unary-plus.rs:5:18
13
+ error: leading `+` is not supported
14
+ --> $DIR/issue-88276-unary-plus.rs:5:20
15
15
|
16
16
LL | let _ = (1.0 + +2.0) * +3.0;
17
- | ^^^ not a valid postfix operator
18
- |
19
- help: use `+= 1` instead
17
+ | ^ unexpected `+`
20
18
|
21
- LL | let _ = ({ let tmp = 1.0 ; 1.0 += 1; tmp }2.0) * +3.0;
22
- | +++++++++++ ~~~~~~~~~~~~~~~~~
23
- help: or, if you don't need to use it as an expression, change it to this
19
+ help: try removing the `+`
24
20
|
25
21
LL - let _ = (1.0 + +2.0) * +3.0;
26
- LL + let _ = (1.0 += 12 .0) * +3.0;
22
+ LL + let _ = (1.0 + 2 .0) * +3.0;
27
23
|
28
24
29
25
error: leading `+` is not supported
You can’t perform that action at this time.
0 commit comments