Skip to content

rustc_builtin_macros cleanup, part 9 - #165161

Open
cyrgani wants to merge 13 commits into
rust-lang:mainfrom
cyrgani:builtin-macros-9
Open

cyrgani wants to merge 13 commits into
rust-lang:mainfrom
cyrgani:builtin-macros-9

Conversation

@cyrgani

@cyrgani cyrgani commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

This PR does two things: first, a lot of outdated, confusing and unhelpful things are renamed. The last few commits then inline most of the larger functions in generic.rs into expand_ext, which allows the compiler to understand that several fields of TraitDef and MethodDef are only used once and don't need to be cloned, which gives some small perf gains.

Previous PR: #163485
r? @nnethercote

@rustbot rustbot added 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 Oct 29, 2026
@panstromek

Copy link
Copy Markdown
Contributor

@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 30, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 30, 2026
`rustc_builtin_macros` cleanup, part 9
@rust-bors

rust-bors Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: c82bfbd (c82bfbd448a8b52d3583642d7ad5398d34ffc48b)
Base parent: 92b5b8c (92b5b8c87c61b20adc9001b41baf587634a74734)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (c82bfbd): comparison URL.

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

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

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=iffy 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
Regressions ❌
(secondary)
0.2% [0.2%, 0.3%] 5
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 5
Improvements ✅
(secondary)
-0.3% [-0.4%, -0.1%] 11
All ❌✅ (primary) -0.2% [-0.2%, -0.2%] 5

Max RSS (memory usage)

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

Cycles

Results (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)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.7% [-2.7%, -2.7%] 1
All ❌✅ (primary) - - 0

Binary size

Results (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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 3
All ❌✅ (primary) - - 0

Bootstrap: 484.843s -> 484.517s (-0.07%)
Artifact size: 406.61 MiB -> 406.69 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 30, 2026
This matches the order in which it is actually written in code.
This allows removing some clones and simplifies the code since it only needs to work with up to two selflike arguments, which is all we need.
This removes several clones and works since each method def only gets expanded once. It also requires inlining `create_derived_impl` to avoid borrow checking errors.
@cyrgani
cyrgani marked this pull request as ready for review October 30, 2026 09:09
@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 30, 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

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants