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

Some parser improvements #127806

Merged
merged 7 commits into from
Jul 18, 2024
Merged

Conversation

nnethercote
Copy link
Contributor

I was looking closely at attribute handling in the parser while debugging some issues relating to #124141, and found a few small improvements.

@spastorino

It has a single call site, it isn't that big, and its name is
confusingly similar to `Parser::parse_item_common`.
Put `attrs` before `e0` because that matches the order in the source
code, where outer attributes appear before expressions.
It has a single call site. Removing it removes the need for an
`ExprKind` check. The commit also clarifies the relevant comment.
It only has two call sites, and it extremely similar to
`Parser::parse_expr_dot_or_call_with`, in both name and behaviour. The
only difference is the latter has an `attrs` argument and an
`ensure_sufficient_stack` call. We can pass in an empty `attrs` as
necessary, as is already done at some `parse_expr_dot_or_call_with` call
sites.
@rustbot
Copy link
Collaborator

rustbot commented Jul 16, 2024

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot 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 Jul 16, 2024
@nnethercote
Copy link
Contributor Author

r? @spastorino

@rustbot rustbot assigned spastorino and unassigned jieyouxu Jul 16, 2024
@nnethercote
Copy link
Contributor Author

I added a couple more commits.

@spastorino
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jul 17, 2024

📌 Commit 9c4f3db has been approved by spastorino

It is now in the queue for this repository.

@bors 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 Jul 17, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 17, 2024
…=spastorino

Some parser improvements

I was looking closely at attribute handling in the parser while debugging some issues relating to rust-lang#124141, and found a few small improvements.

`@spastorino`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 18, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#127542 ([`macro_metavar_expr_concat`] Add support for literals)
 - rust-lang#127652 (Unignore cg_gcc fmt)
 - rust-lang#127664 (Fix precise capturing suggestion for hidden regions when we have APITs)
 - rust-lang#127806 (Some parser improvements)
 - rust-lang#127828 (Commonize `uname -m` results for `aarch64` in docker runner)
 - rust-lang#127845 (unix: break `stack_overflow::install_main_guard` into smaller fn)
 - rust-lang#127854 (Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent`)
 - rust-lang#127861 (Document the column numbers for the dbg! macro)
 - rust-lang#127875 (style-guide: Clarify version-sorting)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 18, 2024
Rollup of 9 pull requests

Successful merges:

 - rust-lang#127542 ([`macro_metavar_expr_concat`] Add support for literals)
 - rust-lang#127652 (Unignore cg_gcc fmt)
 - rust-lang#127664 (Fix precise capturing suggestion for hidden regions when we have APITs)
 - rust-lang#127806 (Some parser improvements)
 - rust-lang#127828 (Commonize `uname -m` results for `aarch64` in docker runner)
 - rust-lang#127845 (unix: break `stack_overflow::install_main_guard` into smaller fn)
 - rust-lang#127859 (ptr::metadata: avoid references to extern types)
 - rust-lang#127861 (Document the column numbers for the dbg! macro)
 - rust-lang#127875 (style-guide: Clarify version-sorting)

r? `@ghost`
`@rustbot` modify labels: rollup
tgross35 added a commit to tgross35/rust that referenced this pull request Jul 18, 2024
…=spastorino

Some parser improvements

I was looking closely at attribute handling in the parser while debugging some issues relating to rust-lang#124141, and found a few small improvements.

```@spastorino```
@bors bors merged commit fa13036 into rust-lang:master Jul 18, 2024
12 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jul 18, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 18, 2024
Rollup of 9 pull requests

Successful merges:

 - rust-lang#127077 (Make language around `ToOwned` for `BorrowedFd` more precise)
 - rust-lang#127523 (Migrate `dump-ice-to-disk` and `panic-abort-eh_frame` `run-make` tests to rmake)
 - rust-lang#127787 (Migrate `atomic-lock-free` to `rmake`)
 - rust-lang#127806 (Some parser improvements)
 - rust-lang#127810 (Rename `tcx` to `cx` in `rustc_type_ir`)
 - rust-lang#127878 (Fix associated item removal suggestion)
 - rust-lang#127886 (Accurate `use` rename suggestion span)
 - rust-lang#127888 (More accurate span for type parameter suggestion)
 - rust-lang#127889 (More accurate span for anonymous argument suggestion)

r? `@ghost`
`@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jul 18, 2024
Rollup merge of rust-lang#127806 - nnethercote:parser-improvements, r=spastorino

Some parser improvements

I was looking closely at attribute handling in the parser while debugging some issues relating to rust-lang#124141, and found a few small improvements.

``@spastorino``
@nnethercote nnethercote deleted the parser-improvements branch July 18, 2024 07:09
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants