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

Still more cfg cleanups #128483

Merged
merged 5 commits into from
Aug 3, 2024
Merged

Conversation

nnethercote
Copy link
Contributor

Found while looking closely at cfg/cfg_attr processing code.

r? @petrochenkov

It has a single use. This makes the `let` handling case in
`parse_stmt_without_recovery` more similar to the statement path and
statement expression cases.
`parse_expr_assoc_with` has an awkward structure -- sometimes the lhs is
already parsed. This commit splits the post-lhs part into a new method
`parse_expr_assoc_rest_with`, which makes everything shorter and
simpler.
It can be done more concisely.
When collecting tokens there are two kinds of range:
- a range relative to the parser's full token stream (which we get when
  we are parsing);
- a range relative to a single AST node's token stream (which we use
  within `LazyAttrTokenStreamImpl` when replacing tokens).

These are currently both represented with `Range<u32>` and it's easy to
mix them up -- until now I hadn't properly understood the difference.

This commit introduces `ParserRange` and `NodeRange` to distinguish
them. This also requires splitting `ReplaceRange` in two, giving the new
types `ParserReplacement` and `NodeReplacement`. (These latter two names
reduce the overloading of the word "range".)

The commit also rewrites some comments to be clearer.

The end result is a little more verbose, but much clearer.
@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 Aug 1, 2024
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Aug 1, 2024

📌 Commit d1f05fd has been approved by petrochenkov

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 Aug 1, 2024
tgross35 added a commit to tgross35/rust that referenced this pull request Aug 1, 2024
…s, r=petrochenkov

Still more `cfg` cleanups

Found while looking closely at `cfg`/`cfg_attr` processing code.

r? `@petrochenkov`
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 1, 2024
Rollup of 5 pull requests

Successful merges:

 - rust-lang#127276 (rustdoc: Remove OpaqueTy)
 - rust-lang#128404 (Revert recent changes to dead code analysis)
 - rust-lang#128466 (Update the stdarch submodule)
 - rust-lang#128483 (Still more `cfg` cleanups)
 - rust-lang#128494 (MIR required_consts, mentioned_items: ensure we do not forget to fill these lists)

r? `@ghost`
`@rustbot` modify labels: rollup
tgross35 added a commit to tgross35/rust that referenced this pull request Aug 1, 2024
…s, r=petrochenkov

Still more `cfg` cleanups

Found while looking closely at `cfg`/`cfg_attr` processing code.

r? ``@petrochenkov``
tgross35 added a commit to tgross35/rust that referenced this pull request Aug 1, 2024
…s, r=petrochenkov

Still more `cfg` cleanups

Found while looking closely at `cfg`/`cfg_attr` processing code.

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

Successful merges:

 - rust-lang#122049 (Promote riscv64gc-unknown-linux-musl to tier 2)
 - rust-lang#128147 (migrate fmt-write-bloat to rmake)
 - rust-lang#128161 (nested aux-build in tests/rustdoc/ tests)
 - rust-lang#128404 (Revert recent changes to dead code analysis)
 - rust-lang#128466 (Update the stdarch submodule)
 - rust-lang#128483 (Still more `cfg` cleanups)
 - rust-lang#128494 (MIR required_consts, mentioned_items: ensure we do not forget to fill these lists)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 2, 2024
…s, r=petrochenkov

Still more `cfg` cleanups

Found while looking closely at `cfg`/`cfg_attr` processing code.

r? ````@petrochenkov````
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 2, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#122049 (Promote riscv64gc-unknown-linux-musl to tier 2)
 - rust-lang#125558 (Tweak type inference for `const` operands in inline asm)
 - rust-lang#126704 (Added SHA512, SM3, SM4 target-features and `sha512_sm_x86` feature gate)
 - rust-lang#128161 (nested aux-build in tests/rustdoc/ tests)
 - rust-lang#128483 (Still more `cfg` cleanups)
 - rust-lang#128528 (Finish removing `has_cpuid`)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 2, 2024
…s, r=petrochenkov

Still more `cfg` cleanups

Found while looking closely at `cfg`/`cfg_attr` processing code.

r? `````@petrochenkov`````
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 2, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#122049 (Promote riscv64gc-unknown-linux-musl to tier 2)
 - rust-lang#126704 (Added SHA512, SM3, SM4 target-features and `sha512_sm_x86` feature gate)
 - rust-lang#128161 (nested aux-build in tests/rustdoc/ tests)
 - rust-lang#128483 (Still more `cfg` cleanups)
 - rust-lang#128528 (Finish removing `has_cpuid`)

r? `@ghost`
`@rustbot` modify labels: rollup
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Aug 2, 2024
…s, r=petrochenkov

Still more `cfg` cleanups

Found while looking closely at `cfg`/`cfg_attr` processing code.

r? ``````@petrochenkov``````
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Aug 2, 2024
…s, r=petrochenkov

Still more `cfg` cleanups

Found while looking closely at `cfg`/`cfg_attr` processing code.

r? ```````@petrochenkov```````
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 2, 2024
Rollup of 9 pull requests

Successful merges:

 - rust-lang#126704 (Added SHA512, SM3, SM4 target-features and `sha512_sm_x86` feature gate)
 - rust-lang#127095 (Migrate `reproducible-build-2` and `stable-symbol-names` `run-make` tests to rmake)
 - rust-lang#128107 (Migrate `raw-dylib-alt-calling-convention`, `raw-dylib-c` and `redundant-libs` `run-make` tests to rmake)
 - rust-lang#128161 (nested aux-build in tests/rustdoc/ tests)
 - rust-lang#128356 (Migrate `cross-lang-lto-clang` and `cross-lang-lto-pgo-smoketest` `run-make` tests to rmake)
 - rust-lang#128404 (Revert recent changes to dead code analysis)
 - rust-lang#128483 (Still more `cfg` cleanups)
 - rust-lang#128528 (Finish removing `has_cpuid`)
 - rust-lang#128557 (chore: use shorthand initializer)

r? `@ghost`
`@rustbot` modify labels: rollup
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Aug 3, 2024
…s, r=petrochenkov

Still more `cfg` cleanups

Found while looking closely at `cfg`/`cfg_attr` processing code.

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

Successful merges:

 - rust-lang#126704 (Added SHA512, SM3, SM4 target-features and `sha512_sm_x86` feature gate)
 - rust-lang#127095 (Migrate `reproducible-build-2` and `stable-symbol-names` `run-make` tests to rmake)
 - rust-lang#127586 (Add `#[must_use]` to some `into_raw*` functions.)
 - rust-lang#128161 (nested aux-build in tests/rustdoc/ tests)
 - rust-lang#128303 (Enable `std::io::copy` specialisation for `std::pipe::{PipeReader, PipeWriter}`)
 - rust-lang#128356 (Migrate `cross-lang-lto-clang` and `cross-lang-lto-pgo-smoketest` `run-make` tests to rmake)
 - rust-lang#128368 (Formatting tweaks)
 - rust-lang#128404 (Revert recent changes to dead code analysis)
 - rust-lang#128483 (Still more `cfg` cleanups)
 - rust-lang#128557 (chore: use shorthand initializer)

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

Successful merges:

 - rust-lang#126704 (Added SHA512, SM3, SM4 target-features and `sha512_sm_x86` feature gate)
 - rust-lang#127095 (Migrate `reproducible-build-2` and `stable-symbol-names` `run-make` tests to rmake)
 - rust-lang#127586 (Add `#[must_use]` to some `into_raw*` functions.)
 - rust-lang#128161 (nested aux-build in tests/rustdoc/ tests)
 - rust-lang#128303 (Enable `std::io::copy` specialisation for `std::pipe::{PipeReader, PipeWriter}`)
 - rust-lang#128356 (Migrate `cross-lang-lto-clang` and `cross-lang-lto-pgo-smoketest` `run-make` tests to rmake)
 - rust-lang#128368 (Formatting tweaks)
 - rust-lang#128404 (Revert recent changes to dead code analysis)
 - rust-lang#128483 (Still more `cfg` cleanups)
 - rust-lang#128557 (chore: use shorthand initializer)

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

Rollup of 7 pull requests

Successful merges:

 - rust-lang#126704 (Added SHA512, SM3, SM4 target-features and `sha512_sm_x86` feature gate)
 - rust-lang#127586 (Add `#[must_use]` to some `into_raw*` functions.)
 - rust-lang#128161 (nested aux-build in tests/rustdoc/ tests)
 - rust-lang#128303 (Enable `std::io::copy` specialisation for `std::pipe::{PipeReader, PipeWriter}`)
 - rust-lang#128368 (Formatting tweaks)
 - rust-lang#128483 (Still more `cfg` cleanups)
 - rust-lang#128557 (chore: use shorthand initializer)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dee57ce into rust-lang:master Aug 3, 2024
6 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 3, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 3, 2024
Rollup merge of rust-lang#128483 - nnethercote:still-more-cfg-cleanups, r=petrochenkov

Still more `cfg` cleanups

Found while looking closely at `cfg`/`cfg_attr` processing code.

r? `````````@petrochenkov`````````
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.

4 participants