Skip to content

Port lint attributes to attribute parser#152369

Open
Bryntet wants to merge 11 commits intorust-lang:mainfrom
Bryntet:lint_attrs
Open

Port lint attributes to attribute parser#152369
Bryntet wants to merge 11 commits intorust-lang:mainfrom
Bryntet:lint_attrs

Conversation

@Bryntet
Copy link
Contributor

@Bryntet Bryntet commented Feb 9, 2026

View all comments

Tracking issue: #131229

Ports #[allow], #[deny], #[expect], #[forbid], and #[warn] to being parsed attrs

I tried my best to make this PR as small as possible, it was difficult. I hope it isn't too difficult to review

r? @JonathanBrouwer
r? @jdonszelmann

@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. labels Feb 9, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Feb 22, 2026
@Bryntet Bryntet changed the title lint attrs Port lint attributes to attribute parser Feb 22, 2026
@Bryntet Bryntet marked this pull request as ready for review February 22, 2026 18:57
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 22, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 22, 2026

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

@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 Feb 22, 2026
@JonathanBrouwer
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 22, 2026
Port lint attributes to attribute parser
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 22, 2026
@Bryntet Bryntet force-pushed the lint_attrs branch 2 times, most recently from e70b414 to d9434c9 Compare February 22, 2026 20:19
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 4, 2026

☀️ Try build successful (CI)
Build commit: ac4191a (ac4191a5f4b62a9b6a5b873cb6061893651a855a, parent: d933cf483edf1605142ac6899ff32536c0ad8b22)

@rust-timer

This comment has been minimized.

@JonathanBrouwer
Copy link
Contributor

That sounds like a great idea, but let's do that in a separate PR after this one merged, this one is already big enough :P

Could I take care of that whenever this PR's merged?

Sure, no guarantees of when that is tho :P

@Bryntet
Copy link
Contributor Author

Bryntet commented Mar 4, 2026

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 4, 2026
Port lint attributes to attribute parser
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ac4191a): comparison URL.

Overall result: ✅ improvements - no action needed

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.

@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.4% [0.2%, 0.6%] 5
Improvements ✅
(primary)
-0.3% [-0.5%, -0.1%] 32
Improvements ✅
(secondary)
-0.3% [-0.7%, -0.0%] 57
All ❌✅ (primary) -0.3% [-0.5%, -0.1%] 32

Max RSS (memory usage)

Results (primary 1.1%, secondary 3.0%)

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

mean range count
Regressions ❌
(primary)
1.1% [0.7%, 2.2%] 4
Regressions ❌
(secondary)
4.3% [0.8%, 9.0%] 12
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.8% [-4.9%, -4.7%] 2
All ❌✅ (primary) 1.1% [0.7%, 2.2%] 4

Cycles

Results (primary 3.2%, secondary 2.4%)

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

mean range count
Regressions ❌
(primary)
3.2% [1.5%, 4.2%] 6
Regressions ❌
(secondary)
4.0% [2.3%, 6.3%] 12
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-16.4% [-16.4%, -16.4%] 1
All ❌✅ (primary) 3.2% [1.5%, 4.2%] 6

Binary size

Results (primary 0.1%, secondary 0.1%)

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

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.1%] 23
Regressions ❌
(secondary)
0.1% [0.0%, 0.1%] 57
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.0%, 0.1%] 23

Bootstrap: 481.183s -> 479.856s (-0.28%)
Artifact size: 394.90 MiB -> 395.15 MiB (0.06%)

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Mar 4, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 4, 2026

☀️ Try build successful (CI)
Build commit: 2b27470 (2b27470284d8dbb36abe146c47345ecce04bcc28, parent: b90dc1e597db0bbc0cab0eccb39747b1a9d7e607)

@JonathanBrouwer
Copy link
Contributor

@rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 4, 2026
@JonathanBrouwer
Copy link
Contributor

@rust-timer build 2b27470

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2b27470): comparison URL.

Overall result: ✅ improvements - no action needed

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.

@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.3% [0.1%, 0.5%] 5
Improvements ✅
(primary)
-0.3% [-0.5%, -0.1%] 22
Improvements ✅
(secondary)
-0.3% [-0.7%, -0.0%] 42
All ❌✅ (primary) -0.3% [-0.5%, -0.1%] 22

Max RSS (memory usage)

Results (primary 0.9%, secondary 3.1%)

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

mean range count
Regressions ❌
(primary)
1.5% [0.6%, 3.2%] 5
Regressions ❌
(secondary)
3.7% [0.7%, 6.7%] 12
Improvements ✅
(primary)
-2.4% [-2.4%, -2.4%] 1
Improvements ✅
(secondary)
-4.6% [-4.6%, -4.6%] 1
All ❌✅ (primary) 0.9% [-2.4%, 3.2%] 6

Cycles

Results (primary 2.7%, secondary 3.8%)

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

mean range count
Regressions ❌
(primary)
2.7% [1.7%, 4.1%] 9
Regressions ❌
(secondary)
3.8% [1.7%, 6.1%] 12
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.7% [1.7%, 4.1%] 9

Binary size

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

Bootstrap: 479.576s -> 480.152s (0.12%)
Artifact size: 397.00 MiB -> 395.12 MiB (-0.47%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 4, 2026
@Bryntet Bryntet force-pushed the lint_attrs branch 2 times, most recently from a1a91c4 to bae47b7 Compare March 4, 2026 21:00
Bryntet added 6 commits March 4, 2026 22:02
also add attr_id to `Stable` variant directly, instead of having to
iterate over all the attrs on the hir_id to find it
also changes method `parse_limited_all` to take Iterator as an input,
to avoid needing to do expensive allocation
also removes E0452 and splits
`tests/rustdoc-ui/lints/renamed-lint-still-applies` into 2 tests

this is because of delayed warn lint being lost on compiler aborting on
error
also buffer any lints coming from pre-expansion, so that they are
emitted with proper lint level
@Bryntet
Copy link
Contributor Author

Bryntet commented Mar 4, 2026

@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 Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. 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