Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 7, 2024

Conversation

dtolnay
Copy link
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
29 checks passed
@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