File tree Expand file tree Collapse file tree 3 files changed +11
-18
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 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> {
269269
270270 if self . prev_token == token:: BinOp ( token:: Plus )
271271 && self . token == token:: BinOp ( token:: Plus )
272+ && self . prev_token . span . between ( self . token . span ) . is_empty ( )
272273 {
273274 let op_span = self . prev_token . span . to ( self . token . span ) ;
274275 // 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
33 |
44LL | 2 + +2;
5- | ^^^ not a valid postfix operator
5+ | ^ unexpected `+`
66 |
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 `+`
128 |
139LL - 2 + +2;
14- LL + 2 += 12 ;
10+ LL + 2 + 2 ;
1511 |
1612
1713error: aborting due to previous error
Original file line number Diff line number Diff line change @@ -10,20 +10,16 @@ LL - let _ = +1;
1010LL + let _ = 1;
1111 |
1212
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
1515 |
1616LL | let _ = (1.0 + +2.0) * +3.0;
17- | ^^^ not a valid postfix operator
18- |
19- help: use `+= 1` instead
17+ | ^ unexpected `+`
2018 |
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 `+`
2420 |
2521LL - 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;
2723 |
2824
2925error: leading `+` is not supported
You can’t perform that action at this time.
0 commit comments