Skip to content

Conversation

JonathanBrouwer
Copy link
Contributor

This work in progress, not ready for review.
PR mostly for ci/perf runs

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Oct 9, 2025
@rust-log-analyzer

This comment has been minimized.

@JonathanBrouwer JonathanBrouwer force-pushed the cfg_attr2 branch 2 times, most recently from 10cf134 to e9bdfb0 Compare October 10, 2025 08:44
@JonathanBrouwer
Copy link
Contributor Author

JonathanBrouwer commented Oct 10, 2025

r? @jdonszelmann
Not ready for review yet, just assigning you

@JonathanBrouwer
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 14, 2025
 Port `#[cfg_attr]` to the new attribute parsing infrastructure
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 14, 2025
@rust-bors
Copy link

rust-bors bot commented Oct 14, 2025

☀️ Try build successful (CI)
Build commit: ff502cb (ff502cb3140362d4d93bde4d537bcdb21bf639be, parent: 4b94758d2ba7d0ef71ccf5fde29ce4bc5d6fe2a4)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ff502cb): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.1% [0.1%, 0.2%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.4%, -0.1%] 14
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -2.2%, secondary 0.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.1% [3.1%, 3.1%] 1
Improvements ✅
(primary)
-2.2% [-2.2%, -2.2%] 1
Improvements ✅
(secondary)
-1.3% [-1.3%, -1.3%] 1
All ❌✅ (primary) -2.2% [-2.2%, -2.2%] 1

Cycles

Results (secondary 3.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.5% [3.5%, 3.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 475.312s -> 475.298s (-0.00%)
Artifact size: 388.16 MiB -> 388.09 MiB (-0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 14, 2025
@JonathanBrouwer JonathanBrouwer marked this pull request as ready for review October 14, 2025 18:00
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 14, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 14, 2025

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 14, 2025
LL + #[cfg_attr(true, #[inline(never)])]
|
LL - #[cfg_attr(true, inline())]
LL + #[cfg_attr(true, #[inline])]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ugly but not a regression, this was already broken before.
#147693
I'll fix this in a separate PR, since this one is already a little big

@JonathanBrouwer
Copy link
Contributor Author

JonathanBrouwer commented Oct 14, 2025

@jdonszelmann I think the perf looks reasonable, more improvements than regressions and it's all secondary benchmarks anyways. Feel free to disagree and I can look into the regressions more though.
(I made no changes to the code since the perf run, only docs and tests, so no need to rerun)

Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
@rustbot
Copy link
Collaborator

rustbot commented Oct 14, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

const CFG_ATTR_NOTE_REF: &str = "for more information, visit \
<https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>";

match cfg_attr.get_normal_item().args {
Copy link
Contributor

@jdonszelmann jdonszelmann Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be nicer to somehow use our new attribute parser logic here already? Especially with the prospect of throwing the old one out some day

Copy link
Contributor Author

@JonathanBrouwer JonathanBrouwer Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that the argument of cfg_attr are not required to be a valid meta item. The sub-attribute could be a proc macro attribute, in which case we still need to have access to the TokenStream. I could not find a nice way to achieve this goal with the new attribute parser logic.

The old attribute parser is not actually used here afaik, we don't parse to a MetaItem here. So throwing the old one out should still be possible with this implementation

@rust-log-analyzer

This comment has been minimized.

Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) perf-regression Performance regression. 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

5 participants