-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Rework pattern and expression nonterminal kinds. #126851
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So we can omit the `token::` qualifier, which gives more space to some cramped code.
Merge `PatParam`/`PatWithOr`, and `Expr`/`Expr2021`, for a few reasons. - It's conceptually nice, because the two pattern kinds and the two expression kinds are very similar. - With expressions in particular, there are several places where both expression kinds get the same treatment. - It removes one unreachable match arm. - Most importantly, for rust-lang#124141 I will need to introduce a new type `MetaVarKind` that is very similar to `NonterminalKind`, but records a couple of extra fields for expression metavars. It's nicer to have a single `MetaVarKind::Expr` expression variant to hold those extra fields instead of duplicating them across two variants `MetaVarKind::{Expr,Expr2021}`. And then it makes sense for patterns to be treated the same way, and for `NonterminalKind` to also be treated the same way. I also clarified the comments, because I have long found them a little hard to understand.
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Jun 23, 2024
Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt |
compiler-errors
approved these changes
Jun 23, 2024
@bors r+ rollup |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Jun 23, 2024
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this pull request
Jun 23, 2024
…r=compiler-errors Rework pattern and expression nonterminal kinds. Some tweaks to `NonterminalKind` that will assist with rust-lang#124141. Details in the individual commits. r? compiler-errors cc `@eholk`
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 23, 2024
…mpiler-errors Rollup of 9 pull requests Successful merges: - rust-lang#126230 (tidy: skip submodules if not present for non-CI environments) - rust-lang#126523 (std: refactor the TLS implementation) - rust-lang#126612 (Update outdated README in build-manifest.) - rust-lang#126616 (less bootstrap warnings) - rust-lang#126663 (remove `GIT_DIR` handling in pre-push hook) - rust-lang#126830 (make unsized_fn_params an internal feature) - rust-lang#126833 (don't ICE when encountering an extern type field during validation) - rust-lang#126837 (delegation: Do not crash on qpaths without a trait) - rust-lang#126851 (Rework pattern and expression nonterminal kinds.) r? `@ghost` `@rustbot` modify labels: rollup
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this pull request
Jun 23, 2024
…r=compiler-errors Rework pattern and expression nonterminal kinds. Some tweaks to `NonterminalKind` that will assist with rust-lang#124141. Details in the individual commits. r? compiler-errors cc ``@eholk``
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 23, 2024
…mpiler-errors Rollup of 9 pull requests Successful merges: - rust-lang#126230 (tidy: skip submodules if not present for non-CI environments) - rust-lang#126608 (Add more constants, functions, and tests for `f16` and `f128`) - rust-lang#126612 (Update outdated README in build-manifest.) - rust-lang#126616 (less bootstrap warnings) - rust-lang#126663 (remove `GIT_DIR` handling in pre-push hook) - rust-lang#126830 (make unsized_fn_params an internal feature) - rust-lang#126833 (don't ICE when encountering an extern type field during validation) - rust-lang#126837 (delegation: Do not crash on qpaths without a trait) - rust-lang#126851 (Rework pattern and expression nonterminal kinds.) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 23, 2024
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#126230 (tidy: skip submodules if not present for non-CI environments) - rust-lang#126612 (Update outdated README in build-manifest.) - rust-lang#126616 (less bootstrap warnings) - rust-lang#126663 (remove `GIT_DIR` handling in pre-push hook) - rust-lang#126830 (make unsized_fn_params an internal feature) - rust-lang#126833 (don't ICE when encountering an extern type field during validation) - rust-lang#126837 (delegation: Do not crash on qpaths without a trait) - rust-lang#126851 (Rework pattern and expression nonterminal kinds.) - rust-lang#126862 (Add needs-symlink directive to compiletest) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 23, 2024
Rollup merge of rust-lang#126851 - nnethercote:NtExprKind-NtPatKind, r=compiler-errors Rework pattern and expression nonterminal kinds. Some tweaks to `NonterminalKind` that will assist with rust-lang#124141. Details in the individual commits. r? compiler-errors cc ```@eholk```
compiler-errors
pushed a commit
to compiler-errors/rust
that referenced
this pull request
Sep 16, 2024
…r=compiler-errors Rework pattern and expression nonterminal kinds. Some tweaks to `NonterminalKind` that will assist with rust-lang#124141. Details in the individual commits. r? compiler-errors cc ```@eholk```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some tweaks to
NonterminalKind
that will assist with #124141. Details in the individual commits.r? compiler-errors
cc @eholk