Skip to content

port lint attributes - #162811

Open
mejrs wants to merge 6 commits into
rust-lang:mainfrom
mejrs:port_lint_check
Open

mejrs wants to merge 6 commits into
rust-lang:mainfrom
mejrs:port_lint_check

Conversation

@mejrs

@mejrs mejrs commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

View all comments

Ports the lint attributes. I've kept this as small as possible, but there is a decent amount of clean up/refactoring that can be done afterwards,

r? @JonathanBrouwer @jdonszelmann
cc @Bryntet

@rustbot

rustbot commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

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

cc @jdonszelmann, @JonathanBrouwer

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in compiler/rustc_attr_ir

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

clippy is developed in its own repository. If possible, consider making this change to rust-lang/rust-clippy instead.

cc @rust-lang/clippy

@rustbot rustbot added 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. labels Sep 15, 2026
Comment on lines +10 to +11
LL | let y: u32 = (x?).try_into().unwrap();
| + +++++++++++++++++++++

@mejrs mejrs Sep 15, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Uh yeah I don't know what's happening here

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is minor enough that I'll put it on my todo list as something that we should fix after merging this PR

@JonathanBrouwer

Copy link
Copy Markdown
Member

I'll take a look at this on Friday! Thanks for doing this!

@Bryntet

Bryntet commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Thanks for picking this up ❤️

@JonathanBrouwer

Copy link
Copy Markdown
Member

cc @cjgillot @petrochenkov in case you'd like to take a look (as reviewers of the original pr #155691)

@mejrs

mejrs commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

I'll take a look at this on Friday! Thanks for doing this!

I'll go ahead and cherrypick some changes from this PR then, some things can be split off.

@petrochenkov petrochenkov self-assigned this Sep 15, 2026
Comment thread tests/ui/unpretty/exhaustive.hir.stdout
@mejrs mejrs mentioned this pull request Sep 15, 2026
@JonathanBrouwer JonathanBrouwer added the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Sep 15, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member

Blocked on #162813

@rust-log-analyzer

This comment has been minimized.

@mejrs

mejrs commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

@bors try @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 Sep 15, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 15, 2026
@rust-bors

rust-bors Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 837b948 (837b9481206c510936be02f4b200f8db8aae1286)
Base parent: 1936d44 (1936d44457352da43b2d740672b940ebc715ac38)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (837b948): comparison URL.

Overall result: ❌✅ regressions and improvements - BENCHMARK(S) FAILED

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

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

❗ ❗ ❗ ❗ ❗
Warning ⚠️: The following benchmark(s) failed to build:

  • image-0.25.6
  • Job failure

❗ ❗ ❗ ❗ ❗

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.6% [0.2%, 3.5%] 197
Regressions ❌
(secondary)
0.9% [0.1%, 5.8%] 170
Improvements ✅
(primary)
-36.2% [-77.2%, -10.4%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-77.2%, 3.5%] 201

Max RSS (memory usage)

Results (primary -7.1%, secondary -1.8%)

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

mean range count
Regressions ❌
(primary)
1.6% [0.6%, 3.1%] 3
Regressions ❌
(secondary)
3.5% [2.4%, 4.1%] 3
Improvements ✅
(primary)
-20.2% [-22.6%, -17.8%] 2
Improvements ✅
(secondary)
-7.1% [-9.4%, -3.6%] 3
All ❌✅ (primary) -7.1% [-22.6%, 3.1%] 5

Cycles

Results (primary -7.6%, secondary 2.7%)

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

mean range count
Regressions ❌
(primary)
3.0% [1.3%, 4.3%] 11
Regressions ❌
(secondary)
3.1% [2.0%, 5.2%] 16
Improvements ✅
(primary)
-36.8% [-77.7%, -10.0%] 4
Improvements ✅
(secondary)
-4.5% [-4.5%, -4.5%] 1
All ❌✅ (primary) -7.6% [-77.7%, 4.3%] 15

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 495.925s -> 496.275s (0.07%)
Artifact size: 406.90 MiB -> 407.07 MiB (0.04%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 15, 2026
@mejrs

mejrs commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

@bors try @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 Oct 3, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 3, 2026
@rust-bors

rust-bors Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 49b38b0 (49b38b0a4ce914e9e8a9b521aff7200e8311a6bc)
Base parent: d6b6dc7 (d6b6dc7982ef5d9117d96d018dfd83098d0471a1)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (49b38b0): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@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.2% [0.2%, 0.2%] 4
Regressions ❌
(secondary)
0.2% [0.1%, 0.3%] 11
Improvements ✅
(primary)
-0.3% [-0.9%, -0.1%] 45
Improvements ✅
(secondary)
-0.4% [-0.8%, -0.1%] 53
All ❌✅ (primary) -0.2% [-0.9%, 0.2%] 49

Max RSS (memory usage)

Results (primary -0.8%, secondary 0.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.9% [2.3%, 5.5%] 2
Improvements ✅
(primary)
-0.8% [-0.8%, -0.8%] 2
Improvements ✅
(secondary)
-3.0% [-3.2%, -2.8%] 2
All ❌✅ (primary) -0.8% [-0.8%, -0.8%] 2

Cycles

Results (secondary 0.3%)

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)
5.3% [3.4%, 7.8%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.3% [-9.4%, -3.2%] 3
All ❌✅ (primary) - - 0

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.2%] 54
Regressions ❌
(secondary)
0.1% [0.0%, 0.2%] 49
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.0%, 0.2%] 54

Bootstrap: 489.814s -> 491.065s (0.26%)
Artifact size: 406.62 MiB -> 408.64 MiB (0.50%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 3, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member

Ooh that's better! 🎉

@JonathanBrouwer JonathanBrouwer left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These are the last comments I have.
I think there's a lot of cleanup work to do after this PR, but this PR is now in a state that merging it will make the situation better rather than worse, so I'm fine with doing these in followup PRs to keep the size of this one manageable.
We should make a list of follow up items though, so they're not forgotten.

@petrochenkov I noticed that you assigned yourself a while ago, would you still like to take a look at this PR?

View changes since this review

Comment thread compiler/rustc_lint/src/levels.rs Outdated
Comment thread compiler/rustc_lint/src/levels.rs Outdated
Comment on lines +10 to +11
LL | let y: u32 = (x?).try_into().unwrap();
| + +++++++++++++++++++++

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is minor enough that I'll put it on my todo list as something that we should fix after merging this PR

Comment thread tests/ui/lint/register-tool-lint.stderr Outdated
@mejrs

mejrs commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

Interesting how this benchmark differs from #152369 (comment)

I wonder if it has something to do with how that PR also moved all the lint store stuff to attribute parsing.

@JonathanBrouwer

Copy link
Copy Markdown
Member

I think indeed there's likely more performance to gain here, but it's already positive so we can delay that :)

@JonathanBrouwer

Copy link
Copy Markdown
Member

You did make LintCheck slightly bigger by making that an Ident, I don't expect that to matter but let's make sure
@bors try @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 Oct 4, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 4, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: be9d55c (be9d55ce5f1537cfe68101e2ffd17e70d4fd3b0e)
Base parent: 4ddbc06 (4ddbc06ea09abcda34f80baf31cc9bc2686b0ae6)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (be9d55c): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never rustc-perf
@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.2% [0.2%, 0.2%] 5
Regressions ❌
(secondary)
0.2% [0.1%, 0.3%] 17
Improvements ✅
(primary)
-0.2% [-0.8%, -0.1%] 25
Improvements ✅
(secondary)
-0.2% [-0.5%, -0.1%] 17
All ❌✅ (primary) -0.2% [-0.8%, 0.2%] 30

Max RSS (memory usage)

Results (primary -2.6%, secondary -3.2%)

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)
- - 0
Improvements ✅
(primary)
-2.6% [-6.0%, -1.0%] 3
Improvements ✅
(secondary)
-3.2% [-3.7%, -2.5%] 3
All ❌✅ (primary) -2.6% [-6.0%, -1.0%] 3

Cycles

Results (primary 4.1%, secondary 4.9%)

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

mean range count
Regressions ❌
(primary)
4.1% [4.1%, 4.1%] 1
Regressions ❌
(secondary)
4.9% [2.1%, 12.9%] 10
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.1% [4.1%, 4.1%] 1

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 491.424s -> 491.568s (0.03%)
Artifact size: 408.69 MiB -> 408.55 MiB (-0.03%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 4, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member

Perf seems slightly worse than the previous run but it's still positive, and the behavior is more correct now, so let's keep things this way

@JonathanBrouwer JonathanBrouwer left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

r=me
Thanks so much for all the effort! This has been a lot of work, both from you and @Bryntet

@petrochenkov do you still want to take a look?
@bors rollup=never

View changes since this review

@mejrs mejrs 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 4, 2026

This branch has not been deployed

No deployments
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-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.

8 participants