Skip to content

Split LintLevelsBuilder::add into add_ast and add_hir - #164790

Merged
rust-bors[bot] merged 4 commits into
rust-lang:mainfrom
JonathanBrouwer:split-add
Oct 26, 2026
Merged

rust-bors[bot] merged 4 commits into
rust-lang:mainfrom
JonathanBrouwer:split-add

Conversation

@JonathanBrouwer

@JonathanBrouwer JonathanBrouwer commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

View all comments

Just making the code nicer

r? @mejrs

@rustbot rustbot added 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. labels Oct 23, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

This shouldn't have any perf effect, but this method is called a lot so lets verify
@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 23, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 23, 2026
Split `LintLevelsBuilder::add` into `add_ast` and `add_hir`
Comment thread compiler/rustc_lint/src/levels.rs Outdated
Comment thread compiler/rustc_lint/src/levels.rs Outdated
}
} else {
None
fn insert_lint_level_overrides(&mut self, attrs: &[impl AttributeExt]) {

@JonathanBrouwer JonathanBrouwer Oct 23, 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.

I'm also contemplating ways to not have to use AttributeExt here, I'd love to get rid of that trait eventually

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.

It appears SINGLE_USE_LIFETIMES is an ast pass and MISSING_DOCS is a hir pass, so you could also just add them in add_ast and add_hir respectively, I don't think the implementation needs to be shared.

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.

Right, I will implement that
@rustbot author

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.

Thanks for the good idea, implemented!

@rust-bors

rust-bors Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 6daff4c (6daff4c4edc31d65a28abf07e77e4aea47e662f3)
Base parent: a0326ca (a0326caa8961d2900534b29e10a57afcdcf65135)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (6daff4c): comparison URL.

Overall result: ❌ regressions - 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.6% [0.1%, 3.8%] 221
Regressions ❌
(secondary)
0.9% [0.1%, 7.1%] 174
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.6% [0.1%, 3.8%] 221

Max RSS (memory usage)

Results (primary 0.6%, 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)
1.0% [0.5%, 1.6%] 10
Regressions ❌
(secondary)
1.5% [0.4%, 3.6%] 8
Improvements ✅
(primary)
-0.8% [-1.1%, -0.4%] 3
Improvements ✅
(secondary)
-2.7% [-7.5%, -0.5%] 4
All ❌✅ (primary) 0.6% [-1.1%, 1.6%] 13

Cycles

Results (primary 1.3%, 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)
2.0% [0.7%, 5.0%] 15
Regressions ❌
(secondary)
2.6% [0.6%, 4.9%] 19
Improvements ✅
(primary)
-0.6% [-0.7%, -0.5%] 5
Improvements ✅
(secondary)
-0.7% [-0.7%, -0.7%] 1
All ❌✅ (primary) 1.3% [-0.7%, 5.0%] 20

Binary size

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

Bootstrap: 487.722s -> 488.616s (0.18%)
Artifact size: 406.42 MiB -> 406.48 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 23, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

Oof that's terrible, lets try again
@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 23, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 23, 2026
Split `LintLevelsBuilder::add` into `add_ast` and `add_hir`
@rust-bors

rust-bors Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 06e3f88 (06e3f888b32e77c4902018b90851d4984a085736)
Base parent: a0326ca (a0326caa8961d2900534b29e10a57afcdcf65135)

@rust-timer

This comment has been minimized.

@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 23, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (06e3f88): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@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.3% [0.2%, 0.3%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 2
All ❌✅ (primary) 0.3% [0.2%, 0.3%] 2

Max RSS (memory usage)

Results (primary 0.8%, secondary 0.8%)

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

mean range count
Regressions ❌
(primary)
1.0% [0.4%, 3.0%] 16
Regressions ❌
(secondary)
2.0% [0.7%, 4.9%] 9
Improvements ✅
(primary)
-1.5% [-2.0%, -1.1%] 2
Improvements ✅
(secondary)
-4.7% [-7.5%, -1.9%] 2
All ❌✅ (primary) 0.8% [-2.0%, 3.0%] 18

Cycles

Results (primary -0.5%, 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.9% [0.4%, 1.4%] 6
Regressions ❌
(secondary)
0.9% [0.5%, 1.7%] 5
Improvements ✅
(primary)
-1.2% [-2.3%, -0.5%] 12
Improvements ✅
(secondary)
-0.5% [-0.5%, -0.5%] 2
All ❌✅ (primary) -0.5% [-2.3%, 1.4%] 18

Binary size

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

Bootstrap: 487.722s -> 490.055s (0.48%)
Artifact size: 406.42 MiB -> 406.56 MiB (0.03%)

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Oct 23, 2026
@rustbot

rustbot commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_attr_ir

cc @jdonszelmann

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 the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Oct 24, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
…uwer

Rollup of 3 perf-sensitive pull requests

Successful merges:

 - #163845 (Add various `#[inline]` annotations for simple functions on hot paths that don't get inlined)
 - #164122 (Don't emit allow attributes in try/contract desugaring)
 - #164260 (create fast path for attributes created in builtin macro expansions)

Failed merges:

 - #164790 (Split `LintLevelsBuilder::add` into `add_ast` and `add_hir`)
rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
…uwer

Rollup of 4 perf-sensitive pull requests

Successful merges:

 - #163845 (Add various `#[inline]` annotations for simple functions on hot paths that don't get inlined)
 - #164122 (Don't emit allow attributes in try/contract desugaring)
 - #164260 (create fast path for attributes created in builtin macro expansions)
 - #164300 (Deduplicate DefId encodings in the query cache)

Failed merges:

 - #164790 (Split `LintLevelsBuilder::add` into `add_ast` and `add_hir`)
rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
…uwer

Rollup of 4 perf-sensitive pull requests

Successful merges:

 - #163845 (Add various `#[inline]` annotations for simple functions on hot paths that don't get inlined)
 - #164122 (Don't emit allow attributes in try/contract desugaring)
 - #164260 (create fast path for attributes created in builtin macro expansions)
 - #164300 (Deduplicate DefId encodings in the query cache)

Failed merges:

 - #164790 (Split `LintLevelsBuilder::add` into `add_ast` and `add_hir`)
rust-bors Bot pushed a commit that referenced this pull request Oct 25, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #163845 (Add various `#[inline]` annotations for simple functions on hot paths that don't get inlined)
 - #164122 (Don't emit allow attributes in try/contract desugaring)
 - #164260 (create fast path for attributes created in builtin macro expansions)
 - #164300 (Deduplicate DefId encodings in the query cache)
 - #164929 (Revert "rustc_codegen_gcc subtree update")

Failed merges:

 - #164790 (Split `LintLevelsBuilder::add` into `add_ast` and `add_hir`)
@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 25, 2026
@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main 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
Copy Markdown
Member Author

@bors r=mejrs force

@rust-bors

rust-bors Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7aa7bb9 has been approved by mejrs

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 26, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 26, 2026
Split `LintLevelsBuilder::add` into `add_ast` and `add_hir`

Just making the code nicer

r? @mejrs
rust-bors Bot pushed a commit that referenced this pull request Oct 26, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #164790 (Split `LintLevelsBuilder::add` into `add_ast` and `add_hir`)
 - #163952 (Remove ignore-unsafe tidy check in alloc/linklist)
 - #164691 (Minor lints and performance improvements for LLDB visualizers)
 - #164925 (Cleanup `rustdoc-html` tests)
 - #164941 (Update actions/setup-python action to v7.1.0)
@rust-bors
rust-bors Bot merged commit c193f9b into rust-lang:main Oct 26, 2026
14 checks passed
rust-bors Bot pushed a commit that referenced this pull request Oct 26, 2026
Rollup merge of #164790 - JonathanBrouwer:split-add, r=mejrs

Split `LintLevelsBuilder::add` into `add_ast` and `add_hir`

Just making the code nicer

r? @mejrs
@rustbot rustbot added this to the 1.101.0 milestone Oct 26, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Note

This PR was benchmarked as part of triage of its containing rollup: triage URL.

Finished benchmarking commit (24e1a68): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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
Improvements ✅
(primary)
-0.2% [-0.2%, -0.1%] 5
Improvements ✅
(secondary)
-0.3% [-0.5%, -0.0%] 29
All ❌✅ (primary) -0.2% [-0.2%, -0.1%] 5

Max RSS (memory usage)

Results (secondary -1.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)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.9% [-2.2%, -1.5%] 6
All ❌✅ (primary) - - 0

Cycles

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

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.1%, 0.2%] 19
Regressions ❌
(secondary)
0.1% [0.0%, 0.3%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.1%, 0.2%] 19

Artifact size: 405.81 MiB -> 405.99 MiB (0.05%)

@mejrs

mejrs commented Oct 26, 2026

Copy link
Copy Markdown
Member

oh interesting, where did that perf come from

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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

4 participants