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

expand: Pick cfgs and cfg_attrs one by one, like other attributes #92473

Merged
merged 1 commit into from
Jan 17, 2022

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Jan 1, 2022

This is a rebase of #83354, but without any language-changing parts (except for #84110), i.e. the attribute expansion order is the same.

This is a pre-requisite for any other changes making cfg attributes closer to regular macro attributes

Two exceptions to the "one by one" behavior are:

  • cfgs eagerly expanded by derive and cfg_eval, they are still expanded in a batch, that's by design.
  • cfgs at the crate root, they are currently expanded not during the main expansion pass, but before that, during #![feature] collection. I'll try to disentangle that logic later in a separate PR.

r? @Aaron1011

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 1, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 1, 2022
@petrochenkov
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 1, 2022
@bors
Copy link
Contributor

bors commented Jan 1, 2022

⌛ Trying commit b21c022c081c8a6a8171d59636bc343789021b84 with merge 34b11d60da4bbfc5edb08212309a5616388876f0...

@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 1, 2022
@rust-log-analyzer

This comment has been minimized.

@petrochenkov petrochenkov 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-perf Status: Waiting on a perf run to be completed. labels Jan 1, 2022
@bors
Copy link
Contributor

bors commented Jan 1, 2022

☀️ Try build successful - checks-actions
Build commit: 34b11d60da4bbfc5edb08212309a5616388876f0 (34b11d60da4bbfc5edb08212309a5616388876f0)

@rust-timer
Copy link
Collaborator

Queued 34b11d60da4bbfc5edb08212309a5616388876f0 with parent ad0d419, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (34b11d60da4bbfc5edb08212309a5616388876f0): comparison url.

Summary: This change led to moderate relevant improvements 🎉 in compiler performance.

  • Moderate improvement in instruction counts (up to -1.0% on incr-patched: println builds of syn)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 1, 2022
@petrochenkov
Copy link
Contributor Author

Ugh, the improvements are likely due to the #84110 part (which is an observable change).
I'll try to remove it and measure again.

@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 2, 2022
@petrochenkov
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 2, 2022
@bors
Copy link
Contributor

bors commented Jan 2, 2022

⌛ Trying commit 80f4f4b5c44fe3c14a95315173756c0c04d95669 with merge 1ea11a5b0c68fb5007144cdf7287545e8071b41e...

@petrochenkov petrochenkov removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 2, 2022
@bors
Copy link
Contributor

bors commented Jan 2, 2022

☀️ Try build successful - checks-actions
Build commit: 1ea11a5b0c68fb5007144cdf7287545e8071b41e (1ea11a5b0c68fb5007144cdf7287545e8071b41e)

@rust-timer
Copy link
Collaborator

Queued 1ea11a5b0c68fb5007144cdf7287545e8071b41e with parent 7b13c62, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1ea11a5b0c68fb5007144cdf7287545e8071b41e): comparison url.

Summary: This change led to moderate relevant improvements 🎉 in compiler performance.

  • Moderate improvement in instruction counts (up to -0.9% on incr-unchanged builds of tuple-stress)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@petrochenkov petrochenkov changed the title [WIP] expand: Pick cfgs and cfg_attrs one by one, like other attributes expand: Pick cfgs and cfg_attrs one by one, like other attributes Jan 10, 2022
@petrochenkov
Copy link
Contributor Author

This should be ready now.
@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 10, 2022
@Aaron1011
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 16, 2022

📌 Commit e87ce7a has been approved by Aaron1011

@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 Jan 16, 2022
@petrochenkov petrochenkov reopened this Jan 16, 2022
@bors
Copy link
Contributor

bors commented Jan 17, 2022

⌛ Testing commit e87ce7a with merge fd20513...

@bors
Copy link
Contributor

bors commented Jan 17, 2022

☀️ Test successful - checks-actions
Approved by: Aaron1011
Pushing fd20513 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 17, 2022
@bors bors merged commit fd20513 into rust-lang:master Jan 17, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 17, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (fd20513): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 17, 2023
…erister

rustc_interface: Add a new query `pre_configure`

It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early.

Crate-level cfg attributes on the crate itself are then expanded normally during the main expansion pass, like attributes on any other nodes.
This is a continuation of rust-lang#92473 and one more step to very unstable crate-level proc macro attributes maybe actually working.

Previously crate attributes were pre-configured simultaneously with feature extraction, and then written directly into `ast::Crate`.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 20, 2023
…erister

rustc_interface: Add a new query `pre_configure`

It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early.

Crate-level cfg attributes on the crate itself are then expanded normally during the main expansion pass, like attributes on any other nodes.
This is a continuation of rust-lang#92473 and one more step to very unstable crate-level proc macro attributes maybe actually working.

Previously crate attributes were pre-configured simultaneously with feature extraction, and then written directly into `ast::Crate`.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Mar 21, 2023
…erister

rustc_interface: Add a new query `pre_configure`

It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early.

Crate-level cfg attributes on the crate itself are then expanded normally during the main expansion pass, like attributes on any other nodes.
This is a continuation of rust-lang#92473 and one more step to very unstable crate-level proc macro attributes maybe actually working.

Previously crate attributes were pre-configured simultaneously with feature extraction, and then written directly into `ast::Crate`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 23, 2023
…ister

rustc_interface: Add a new query `pre_configure`

It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early.

Crate-level cfg attributes on the crate itself are then expanded normally during the main expansion pass, like attributes on any other nodes.
This is a continuation of rust-lang#92473 and one more step to very unstable crate-level proc macro attributes maybe actually working.

Previously crate attributes were pre-configured simultaneously with feature extraction, and then written directly into `ast::Crate`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

7 participants