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

Add both variants of half open range patterns to the grammar #37

Merged
merged 2 commits into from Aug 13, 2021

Conversation

lf-
Copy link
Member

@lf- lf- commented Aug 4, 2021

This is prompted by
rust-lang/rust-analyzer#9779, but it
is not actually a prerequisite of making that one happen as this commit
doesn't change the generated code on the r-a side.

Relevant PR (that does not require this one be merged immediately/a release made): rust-lang/rust-analyzer#9780

// 1..2
| start:Pat op:('..' | '..=') end:Pat
// ..2
| op:('..' | '..=') end:Pat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's fold this into the same case, like we did for RangeExpr

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are slightly semantically different: what I wrote here is 1..2 or 1.. or ..2 but not ... rustc will syntax error if you put .., although it will tell you what you did wrong:

error: `..` patterns are not allowed here
 --> src/main.rs:3:9
  |
3 |         .. => 4,
  |         ^^
  |
  = note: only allowed in tuple, tuple struct, and slice patterns

@matklad
Copy link
Member

matklad commented Aug 4, 2021

could you also bump version in Cargo.toml to get this released?

This is prompted by
rust-lang/rust-analyzer#9779, but it
is not actually a prerequisite of making that one happen as this commit
doesn't change the generated code on the r-a side.
@lf-
Copy link
Member Author

lf- commented Aug 13, 2021

bors r+

@bors
Copy link
Contributor

bors bot commented Aug 13, 2021

Build succeeded:

@bors bors bot merged commit 1c7a5c8 into rust-analyzer:master Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants