dtolnay / syn

Parser for Rust source code
Apache License 2.0
2.79k stars 306 forks source link

Parenthesize ranges on left-hand side of assignment operator #1698

Closed dtolnay closed 1 month ago

dtolnay commented 1 month ago

Unparenthesized ranges are legal on the right of an assignment, but not on the left of an assignment.

error: expected one of `;` or `}`, found `=`
 --> src/main.rs:3:12
  |
3 |         .. = true;
  |            ^ expected one of `;` or `}`

error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `=`
 --> src/main.rs:6:14
  |
6 |         a..b = true;
  |              ^ expected one of 8 possible tokens