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

rustc_expand cleanups #124607

Merged
merged 14 commits into from
May 3, 2024
Merged

rustc_expand cleanups #124607

merged 14 commits into from
May 3, 2024

Conversation

nnethercote
Copy link
Contributor

Some cleanups I made while looking through this code. Nothing that requires any real domain-specific knowledge about this crate.

r? @michaelwoerister

@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 May 2, 2024
@michaelwoerister
Copy link
Member

Looks good to me, thanks for the PR, @nnethercote!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 2, 2024

📌 Commit 40f54bd has been approved by michaelwoerister

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 May 2, 2024
@bors
Copy link
Contributor

bors commented May 2, 2024

☔ The latest upstream changes (presumably #124521) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 2, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request May 2, 2024
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#124345 (Enable `--check-cfg` by default in UI tests)
 - rust-lang#124412 (io safety: update Unix explanation to use `Arc`)
 - rust-lang#124441 (String.truncate comment microfix (greater or equal))
 - rust-lang#124604 (library/std: Remove unused `gimli-symbolize` feature)

Failed merges:

 - rust-lang#124607 (`rustc_expand` cleanups)
 - rust-lang#124613 (Allow fmt to run on rmake.rs test files)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request May 2, 2024
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#124345 (Enable `--check-cfg` by default in UI tests)
 - rust-lang#124412 (io safety: update Unix explanation to use `Arc`)
 - rust-lang#124441 (String.truncate comment microfix (greater or equal))
 - rust-lang#124604 (library/std: Remove unused `gimli-symbolize` feature)

Failed merges:

 - rust-lang#124607 (`rustc_expand` cleanups)
 - rust-lang#124613 (Allow fmt to run on rmake.rs test files)

r? `@ghost`
`@rustbot` modify labels: rollup
nnethercote added 14 commits May 3, 2024 09:06
Sort them, and remove the unused ones (`lint_reasons` and
`proc_macro_span`).
They each have a single call site.
Control flow never gets past the end of the `ExpandResult::Retry` match
arm, due to the `span_bug` and the `continue`. Therefore, the code after
the match can only be reached from the `ExpandResult::Ready` arm.

This commit moves that code after the match into the
`ExpandResult::Ready` arm, avoiding the need for the `continue` in the
`ExpandResult::Retry` arm.
Too clever by half, IMO.
Alongside the existing `Invocation::span`.
Because the type is not obvious, and this clarifies things.
It is currently an enum and the `tts` and `idx` fields are repeated
across the two variants.

This commit splits it into a struct `Frame` and an enum `FrameKind`, to
factor out the duplication. The commit also renames `Frame::new` as
`Frame::new_delimited` and adds `Frame::new_sequence`. I.e. both
variants now have a constructor.
@nnethercote nnethercote force-pushed the rustc_expand-cleanups branch from 40f54bd to 3a3a15d Compare May 2, 2024 23:43
@nnethercote
Copy link
Contributor Author

I rebased.

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented May 2, 2024

📌 Commit 3a3a15d has been approved by compiler-errors

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 2, 2024
fmease added a commit to fmease/rust that referenced this pull request May 3, 2024
… r=compiler-errors

`rustc_expand` cleanups

Some cleanups I made while looking through this code. Nothing that requires any real domain-specific knowledge about this crate.

r? `@michaelwoerister`
fmease added a commit to fmease/rust that referenced this pull request May 3, 2024
… r=compiler-errors

`rustc_expand` cleanups

Some cleanups I made while looking through this code. Nothing that requires any real domain-specific knowledge about this crate.

r? ``@michaelwoerister``
bors added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2024
Rollup of 8 pull requests

Successful merges:

 - rust-lang#124412 (io safety: update Unix explanation to use `Arc`)
 - rust-lang#124441 (String.truncate comment microfix (greater or equal))
 - rust-lang#124594 (run-make-support: preserve tooks.mk behavior for EXTRACXXFLAGS)
 - rust-lang#124604 (library/std: Remove unused `gimli-symbolize` feature)
 - rust-lang#124607 (`rustc_expand` cleanups)
 - rust-lang#124609 (variable-precision float operations can differ depending on optimization levels)
 - rust-lang#124610 (Tweak `consts_may_unify`)
 - rust-lang#124612 (Add support for inputing via stdin with run-make-support)

r? `@ghost`
`@rustbot` modify labels: rollup
fmease added a commit to fmease/rust that referenced this pull request May 3, 2024
… r=compiler-errors

`rustc_expand` cleanups

Some cleanups I made while looking through this code. Nothing that requires any real domain-specific knowledge about this crate.

r? ```@michaelwoerister```
bors added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2024
Rollup of 7 pull requests

Successful merges:

 - rust-lang#124441 (String.truncate comment microfix (greater or equal))
 - rust-lang#124594 (run-make-support: preserve tooks.mk behavior for EXTRACXXFLAGS)
 - rust-lang#124604 (library/std: Remove unused `gimli-symbolize` feature)
 - rust-lang#124607 (`rustc_expand` cleanups)
 - rust-lang#124609 (variable-precision float operations can differ depending on optimization levels)
 - rust-lang#124610 (Tweak `consts_may_unify`)
 - rust-lang#124637 (AST pretty: Use `builtin_syntax` for type ascription)

Failed merges:

 - rust-lang#124638 (Move some tests from `rustc_expand` to `rustc_parse`.)

r? `@ghost`
`@rustbot` modify labels: rollup
@michaelwoerister
Copy link
Member

r=compiler-errors

Wrong Michael 😉

@bors r=michaelwoerister

@bors
Copy link
Contributor

bors commented May 3, 2024

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented May 3, 2024

📌 Commit 3a3a15d has been approved by michaelwoerister

It is now in the queue for this repository.

@nnethercote
Copy link
Contributor Author

Wrong Michael 😉

Whoops, sorry!

bors added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#123480 (deref patterns: impl `DerefPure` for more std types)
 - rust-lang#124412 (io safety: update Unix explanation to use `Arc`)
 - rust-lang#124441 (String.truncate comment microfix (greater or equal))
 - rust-lang#124594 (run-make-support: preserve tooks.mk behavior for EXTRACXXFLAGS)
 - rust-lang#124604 (library/std: Remove unused `gimli-symbolize` feature)
 - rust-lang#124607 (`rustc_expand` cleanups)
 - rust-lang#124609 (variable-precision float operations can differ depending on optimization levels)
 - rust-lang#124610 (Tweak `consts_may_unify`)
 - rust-lang#124626 (const_eval_select: add tracking issue)
 - rust-lang#124637 (AST pretty: Use `builtin_syntax` for type ascription)

Failed merges:

 - rust-lang#124638 (Move some tests from `rustc_expand` to `rustc_parse`.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ad0be15 into rust-lang:master May 3, 2024
6 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 3, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2024
Rollup merge of rust-lang#124607 - nnethercote:rustc_expand-cleanups, r=compiler-errors

`rustc_expand` cleanups

Some cleanups I made while looking through this code. Nothing that requires any real domain-specific knowledge about this crate.

r? ````@michaelwoerister````
@RalfJung
Copy link
Member

RalfJung commented May 3, 2024

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

None yet

5 participants