Skip to content

Try to make FieldDef smaller - #157986

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
panstromek:make-field-def-smaller
Jul 23, 2026
Merged

Try to make FieldDef smaller#157986
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
panstromek:make-field-def-smaller

Conversation

@panstromek

@panstromek panstromek commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

View all comments

Tries to mitigate the regression from #156824. We do this by Option Boxing together all the properties that are only used for unstable features.

fixes #157003

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. labels Jun 16, 2026
@panstromek

Copy link
Copy Markdown
Contributor 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 Jun 16, 2026
@rust-bors

This comment has been minimized.

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

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 289b567 (289b567a59d12dd1f7712d6ff110fbd73a56766d, parent: 89a99936d9e76a50e8df622e7242190841fd871b)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (289b567): comparison URL.

Overall result: ✅ improvements - no action needed

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.

@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
Improvements ✅
(primary)
-0.2% [-0.4%, -0.2%] 10
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.1%] 7
All ❌✅ (primary) -0.2% [-0.4%, -0.2%] 10

Max RSS (memory usage)

Results (primary 6.4%, secondary 2.0%)

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

mean range count
Regressions ❌
(primary)
6.4% [2.4%, 10.6%] 3
Regressions ❌
(secondary)
5.9% [5.9%, 5.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) 6.4% [2.4%, 10.6%] 3

Cycles

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

Binary size

Results (primary -0.0%)

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.0% [-0.0%, -0.0%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 4

Bootstrap: 522.035s -> 522.066s (0.01%)
Artifact size: 401.81 MiB -> 401.82 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 16, 2026
@rust-bors

This comment has been minimized.

Comment thread compiler/rustc_ast/src/ast.rs Outdated
Comment thread compiler/rustc_ast/src/ast.rs Outdated
@panstromek

panstromek commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

I'll undraft this for preliminary review, because I want to get some second opinion. This helps to mitigate the perf regression, but feels somewhat arbitrary/ad-hoc to me? I'm not sure if this is the right approach.

Also, this exploits the fact that these features are unstable, and used rarely - as soon as the majority of fields in the ecosystem use at least one of those features (presumably the default value in most cases), this will no longer be an optimization.

@panstromek
panstromek marked this pull request as ready for review July 12, 2026 11:55
@rustbot

rustbot commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

The parser was modified, potentially altering the grammar of (stable) Rust
which would be a breaking change.

cc @fmease

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

cc @rust-lang/clippy

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

cc @rust-lang/rustfmt

@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 Jul 12, 2026
@rustbot

rustbot commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

r? @khyperia

rustbot has assigned @khyperia.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 18 candidates

@khyperia

Copy link
Copy Markdown
Contributor

apologies, I've fallen ill and probably won't get around to reviewing this for a while, so I'm rerolling

r? compiler

@rustbot rustbot assigned petrochenkov and unassigned khyperia Jul 13, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

We need to re-benchmark this after #158942, tokens in MutRestriction were clearly unnecessary.
@rustbot author

@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 Jul 13, 2026
@rustbot

rustbot commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Comment thread compiler/rustc_ast/src/ast.rs Outdated
Comment thread compiler/rustc_ast_lowering/src/item.rs Outdated
Comment thread compiler/rustc_parse/src/parser/item.rs Outdated
Comment thread compiler/rustc_resolve/src/build_reduced_graph.rs Outdated
@petrochenkov

Copy link
Copy Markdown
Contributor

Some tests are also failing.
@rustbot author

@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 Jul 20, 2026
@rustbot

rustbot commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Changes to the size of AST and/or HIR nodes.

cc @nnethercote

@panstromek
panstromek force-pushed the make-field-def-smaller branch from f94ea58 to ce94ff5 Compare July 22, 2026 19:43
@rustbot

rustbot commented Jul 22, 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.

@panstromek

Copy link
Copy Markdown
Contributor Author

@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 Jul 23, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

r=me after squashing commits.
@rustbot author

@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 Jul 23, 2026
@panstromek
panstromek force-pushed the make-field-def-smaller branch from ce94ff5 to 283ec3a Compare July 23, 2026 12:44
@panstromek

Copy link
Copy Markdown
Contributor Author

Thanks! I squashed the commits but I don't have rights to r= you. Sorry for the churn.

@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 Jul 23, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 283ec3a has been approved by petrochenkov

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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 23, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 23, 2026
@rust-bors

rust-bors Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: petrochenkov
Duration: 3h 33m 46s
Pushing 89c61a7 to main...

@rust-bors
rust-bors Bot merged commit 89c61a7 into rust-lang:main Jul 23, 2026
14 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 2d8fa67 (parent) -> 89c61a7 (this PR)

Test differences

Show 14 test diffs

14 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 89c61a7545da48b06116675b888398d02a4064c7 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-gnu-gcc-core-tests: 8m 10s -> 14m 30s (+77.4%)
  2. dist-x86_64-mingw: 1h 36m -> 2h 41m (+68.5%)
  3. optional-x86_64-gnu-parallel-frontend: 1h 30m -> 2h 9m (+43.7%)
  4. pr-check-2: 29m 31s -> 40m 9s (+36.0%)
  5. x86_64-gnu-llvm-21-3: 1h 21m -> 1h 50m (+35.9%)
  6. arm-android: 1h 3m -> 1h 21m (+28.7%)
  7. dist-ohos-aarch64: 59m 18s -> 1h 16m (+28.4%)
  8. x86_64-mingw-1: 2h 24m -> 3h 2m (+25.9%)
  9. dist-s390x-linux: 1h 10m -> 1h 28m (+24.7%)
  10. x86_64-gnu-llvm-21: 1h 13m -> 55m 27s (-24.6%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (89c61a7): 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.3%, -0.2%] 12
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.2% [-0.3%, -0.2%] 12

Max RSS (memory usage)

Results (primary 2.8%, secondary -4.2%)

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

mean range count
Regressions ❌
(primary)
2.8% [2.8%, 2.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.2% [-5.2%, -2.6%] 3
All ❌✅ (primary) 2.8% [2.8%, 2.8%] 1

Cycles

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

Binary size

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

Bootstrap: 488.662s -> 487.226s (-0.29%)
Artifact size: 387.62 MiB -> 387.62 MiB (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Try to make FieldDef smaller

6 participants