Skip to content

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

Merged
dtolnay merged 1 commit intomasterfrom
rangeassign
Jul 7, 2024
Merged

Parenthesize ranges on left-hand side of assignment operator#1698
dtolnay merged 1 commit intomasterfrom
rangeassign

Conversation

@dtolnay
Copy link
Copy Markdown
Owner

@dtolnay dtolnay commented Jul 7, 2024

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

@dtolnay dtolnay merged commit 63452ac into master Jul 7, 2024
@dtolnay dtolnay deleted the rangeassign branch July 7, 2024 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant