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
@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)

@JonathanBrouwer JonathanBrouwer force-pushed the cfg_attr2 branch 2 times, most recently from 2d7c376 to 1a84725 Compare October 14, 2025 18:11
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

for attr in doc_cfg {
if let Some(cfg_mi) =
attr.meta_item().and_then(|attr| rustc_expand::config::parse_cfg(attr, sess))
attr.meta_item().and_then(|attr| rustc_expand::config::parse_cfg_old(attr, sess))
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we still using the old infra in rustdoc?

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 for the cfg option in the #[doc] attribute

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Oct 15, 2025
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
@rustbot
Copy link
Collaborator

rustbot commented Oct 15, 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.

@JonathanBrouwer
Copy link
Contributor Author

JonathanBrouwer commented Oct 15, 2025

@jdonszelmann I think I improved the diagnostics a lot now :)
I am manually building the diagnostics because sadly I don't have access to the right context in parse_cfg_attr to make them using the normal methods on the context. It's all a little annoying because cfg_attr is special and we cannot use the new parser structs until we build a Parser object with the tokenstream of the attribute, but errors may already occur before that

@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 Oct 15, 2025
//@ edition:2018
//@ aux-build: remove-extern-crate.rs
//@ run-rustfix
//@ rustfix-only-machine-applicable
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 needed because otherwise it tries to apply the suggestion of the cfg_attr syntax which has holes and therefore fails

| ^^^^^^^^
| ^^^^^^^^^^^^^^^--------^^^
| | |
| | expected a valid identifier here
Copy link
Contributor

Choose a reason for hiding this comment

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

could be cool if we could detect paths here, lets make an issue for that

@jdonszelmann
Copy link
Contributor

@bors r+ rollup not entirely happy with this but it's a clear improvement

@bors
Copy link
Collaborator

bors commented Oct 18, 2025

📌 Commit 090dad0 has been approved by jdonszelmann

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 Oct 18, 2025
bors added a commit that referenced this pull request Oct 18, 2025
Rollup of 6 pull requests

Successful merges:

 - #146509 (Result/Option layout guarantee clarifications)
 - #147494 (std::thread spawn: Docs: Link to Builder::spawn; Make same.)
 - #147532 ( Port `#[cfg_attr]` to the new attribute parsing infrastructure)
 - #147783 (bootstrap: migrate to object 0.37)
 - #147792 (Fix autodiff incorrectly applying fat-lto to proc-macro crates )
 - #147809 (rustdoc: Fix passes order so intra-doc links are collected after stripping passes)

Failed merges:

 - #147813 (Warn on unused_attributes in uitests )

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2b582ea into rust-lang:master Oct 18, 2025
11 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 18, 2025
rust-timer added a commit that referenced this pull request Oct 18, 2025
Rollup merge of #147532 - JonathanBrouwer:cfg_attr2, r=jdonszelmann

 Port `#[cfg_attr]` to the new attribute parsing infrastructure

This work in progress, not ready for review.
PR mostly for ci/perf runs
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-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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants