Skip to content

syntax: Rewrite parsing of patterns#23930

Merged
bors merged 2 commits into
rust-lang:masterfrom
petrochenkov:issue23656
Apr 3, 2015
Merged

syntax: Rewrite parsing of patterns#23930
bors merged 2 commits into
rust-lang:masterfrom
petrochenkov:issue23656

Conversation

@petrochenkov

Copy link
Copy Markdown
Contributor

Fixes #22757
Fixes #22972
Fixes #23044
Fixes #23151
Fixes #23597
Fixes #23656
Fixes #23929
It also fixes some other corner cases in range patterns, like incorrect spans or not accepting global paths after ....

It passes make check but needs some additional tests (then it will fix #22546 as well), I'll write them today or tomorrow.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @nrc

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton

Copy link
Copy Markdown
Member

Nice!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you explain the reasoning behind why it is safe to remove this check please?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Flag RESTRICTION_NO_BAR_OP is checked here but it isn't set anywhere, so I removed the check and the flag itself. RESTRICTION_NO_BAR_OP was used before in parse_pat, see my line comments there.

@nrc

nrc commented Apr 2, 2015

Copy link
Copy Markdown
Member

lgtm, I just want to be clear about removing that one check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here parse_expr_res(RESTRICTION_NO_BAR_OP) was mistakenly used to parse plain identifier.

@nrc

nrc commented Apr 2, 2015

Copy link
Copy Markdown
Member

Ok, sounds good, thanks for the explanation.

@bors: r+ d9a0ca01f3938efbb34587e3f52214d8c0bc1624

@bors

bors commented Apr 2, 2015

Copy link
Copy Markdown
Collaborator

⌛ Testing commit d9a0ca0 with merge eb9ca18...

@bors

bors commented Apr 2, 2015

Copy link
Copy Markdown
Collaborator

💔 Test failed - auto-linux-64-x-android-t

@petrochenkov

Copy link
Copy Markdown
Contributor Author

Rebased and fixed.

@nrc

nrc commented Apr 3, 2015

Copy link
Copy Markdown
Member

@bors: r+ 76567a6

@bors

bors commented Apr 3, 2015

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 76567a6 with merge 0640106...

@bors

bors commented Apr 3, 2015

Copy link
Copy Markdown
Collaborator

⛄ The build was interrupted to prioritize another pull request.

@bors

bors commented Apr 3, 2015

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 76567a6 with merge 80def6c...

bors added a commit that referenced this pull request Apr 3, 2015
Fixes #22757
Fixes #22972
Fixes #23044
Fixes #23151
Fixes #23597
Fixes #23656
Fixes #23929
It also fixes some other corner cases in range patterns, like incorrect spans or not accepting global paths after `...`.

It passes `make check` but needs some additional tests (then it will fix #22546 as well), I'll write them today or tomorrow.
Manishearth added a commit to Manishearth/rust that referenced this pull request Apr 3, 2015
Fixes rust-lang#22757
Fixes rust-lang#22972
Fixes rust-lang#23044
Fixes rust-lang#23151
Fixes rust-lang#23597
Fixes rust-lang#23656
Fixes rust-lang#23929
It also fixes some other corner cases in range patterns, like incorrect spans or not accepting global paths after `...`.

It passes `make check` but needs some additional tests (then it will fix rust-lang#22546 as well), I'll write them today or tomorrow.
@bors

bors commented Apr 3, 2015

Copy link
Copy Markdown
Collaborator

bors added a commit that referenced this pull request Apr 3, 2015
@bors bors merged commit 76567a6 into rust-lang:master Apr 3, 2015
@ghost

ghost commented Apr 3, 2015

Copy link
Copy Markdown

@petrochenkov Did you mean to say that you'd add the test cases in a separate PR? As it is, none of the fixed issues have any related tests so perhaps we should reopen them?

@petrochenkov

Copy link
Copy Markdown
Contributor Author

@jakub-
I meant to write the tests as a part of this PR but was busy, so I'm going to submit them separately. All the mentioned issues are essentially duplicates, so I'll open one blanket E-needstest issue for them if I don't submit the PR with tests in the next couple of hours.

Manishearth added a commit to Manishearth/rust that referenced this pull request Apr 4, 2015
@bombless

bombless commented Apr 4, 2015

Copy link
Copy Markdown
Contributor

Hmm @bors closed #22546 after merging this, but I believe it is an irrelevant issue, since the core idea of that issue is about discussing whether we should allow type parameters in pattern.

@bombless

bombless commented Apr 4, 2015

Copy link
Copy Markdown
Contributor

cc @pnkfelix

@brson

brson commented Apr 7, 2015

Copy link
Copy Markdown
Contributor

@bombless I reopened that issue for you.

@brson

brson commented Apr 7, 2015

Copy link
Copy Markdown
Contributor

Awesome list of fixes.

@pnkfelix

pnkfelix commented Apr 7, 2015

Copy link
Copy Markdown
Contributor

@bombless thanks for the pro-active note. However, during triage (I think), the team decided as noted in e.g. this comment that we would keep the syntax, and that we just needed to exercise the edge cases more thoroughly.

@pnkfelix

pnkfelix commented Apr 7, 2015

Copy link
Copy Markdown
Contributor

But, skimming this PR, it seems like it did not actually add any tests relevant to #22546, so I guess that issue should remain open.

@petrochenkov

Copy link
Copy Markdown
Contributor Author

@pnkfelix
The follow-up PR (#24033) contains some tests for #22546. I don't know, whether that enough or not.

@petrochenkov petrochenkov deleted the issue23656 branch May 9, 2015 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment