Skip to content

Fancy paramenv accessors that communicate the access pattern better. - #163477

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
jdonszelmann:paramenv-accessors
Nov 5, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
jdonszelmann:paramenv-accessors

Conversation

@jdonszelmann

@jdonszelmann jdonszelmann commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

r? @lcnr or @rust-lang/initiative-trait-system-refactor

This is a single commit, to precede the future change of "compressed trait clauses". It adds a lot of the infrastructure, without making any real changes that may affect performance. As such it forms a separately reviewable step. Even though this isn't on its own such a useful change, it mostly refactors things, it does still make for a nicer API surface.

Importantly, with compressed trait clauses (i.e. encoding some common traits as where self_ty : <bitset of common traits>), it becomes very important to be careful with how we iterate over caller bounds. I've tried other methods, but the typestate API (as proposed in this PR) is the only one I've found that's both ergonomic, and still allows for implementing compressed trait clauses performantly.

Note

I've not used an LLM for any part of this PR, or any other PR I make. This includes any related work like research.

@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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 29, 2026
@jdonszelmann
jdonszelmann force-pushed the paramenv-accessors branch 3 times, most recently from 6d71f6c to 82b91b0 Compare September 29, 2026 13:07
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Nov 2, 2026
@jdonszelmann

Copy link
Copy Markdown
Contributor Author

r? project-trait-system-refactor

@jdonszelmann
jdonszelmann marked this pull request as ready for review November 2, 2026 14:40
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 2, 2026
@rustbot

rustbot commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in const_evaluatable.rs

cc @BoxyUwU

@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 Nov 2, 2026
@rustbot rustbot assigned adwinwhite and unassigned lcnr Nov 2, 2026
@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

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 T-clippy Relevant to the Clippy team. label Nov 2, 2026
@jdonszelmann

Copy link
Copy Markdown
Contributor Author

r? @ShoyuVanilla

@rustbot rustbot assigned ShoyuVanilla and unassigned adwinwhite Nov 3, 2026
@rust-bors

This comment has been minimized.

@ShoyuVanilla

Copy link
Copy Markdown
Member

Let me check the perf, just in case 😄
@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@jdonszelmann

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 4, 2026
Fancy paramenv accessors that communicate the access pattern better.
@rust-bors

This comment has been minimized.

@rust-bors

rust-bors Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: aa31ab2 (aa31ab2e728749c5c049528aabf370438d86507d)
Base parent: 2d20b42 (2d20b42b883dcfc014f3c2c56081eeb6091c2179)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (aa31ab2): comparison URL.

Overall result: ❌ regressions - 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.8% [0.5%, 1.3%] 16
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.8% [0.5%, 1.3%] 16

Max RSS (memory usage)

Results (primary -0.5%, secondary -0.4%)

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.3%, 3.2%] 2
Regressions ❌
(secondary)
2.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
-3.8% [-6.3%, -1.3%] 2
Improvements ✅
(secondary)
-3.1% [-3.1%, -3.1%] 1
All ❌✅ (primary) -0.5% [-6.3%, 3.2%] 4

Cycles

Results (primary 2.7%)

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

mean range count
Regressions ❌
(primary)
2.7% [2.3%, 3.0%] 6
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.7% [2.3%, 3.0%] 6

Binary size

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

Bootstrap: 480.462s -> 481.851s (0.29%)
Artifact size: 406.22 MiB -> 406.32 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 Nov 4, 2026
@jdonszelmann

Copy link
Copy Markdown
Contributor Author

smol regressions, unfortunate but I'll keep working on those in subsequent PRs. Without this change more changes are impossible, and I do not wish to ask someone to review this PR together with subtler changes.

@bors r=ShoyuVanilla

@rust-bors

rust-bors Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 08fe89e has been approved by ShoyuVanilla

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

Copy link
Copy Markdown
Member

Interesting. The regressed benchmarks have next-solver counterparts but they aren't regressed 🤔

@jdonszelmann

Copy link
Copy Markdown
Contributor Author

yea that makes sense, in the next solver I already in this PR use slightly more specific accessors that probably perform a little better

jhpratt added a commit to jhpratt/rust that referenced this pull request Nov 5, 2026
…=ShoyuVanilla

Fancy paramenv accessors that communicate the access pattern better.

r? @lcnr or @rust-lang/initiative-trait-system-refactor

This is a single commit, to precede the future change of "compressed trait clauses". It adds a lot of the infrastructure, without making any real changes that may affect performance. As such it forms a separately reviewable step. Even though this isn't on its own such a useful change, it mostly refactors things, it does still make for a nicer API surface.

Importantly, with compressed trait clauses (i.e. encoding some common traits as `where self_ty : <bitset of common traits>`), it becomes very important to be careful with how we iterate over caller bounds. I've tried other methods, but the typestate API (as proposed in this PR) is the only one I've found that's both ergonomic, and still allows for implementing compressed trait clauses performantly.

> [!NOTE]
> I've not used an LLM for any part of this PR, or any other PR I make. This includes any related work like research.
jhpratt added a commit to jhpratt/rust that referenced this pull request Nov 5, 2026
…=ShoyuVanilla

Fancy paramenv accessors that communicate the access pattern better.

r? @lcnr or @rust-lang/initiative-trait-system-refactor

This is a single commit, to precede the future change of "compressed trait clauses". It adds a lot of the infrastructure, without making any real changes that may affect performance. As such it forms a separately reviewable step. Even though this isn't on its own such a useful change, it mostly refactors things, it does still make for a nicer API surface.

Importantly, with compressed trait clauses (i.e. encoding some common traits as `where self_ty : <bitset of common traits>`), it becomes very important to be careful with how we iterate over caller bounds. I've tried other methods, but the typestate API (as proposed in this PR) is the only one I've found that's both ergonomic, and still allows for implementing compressed trait clauses performantly.

> [!NOTE]
> I've not used an LLM for any part of this PR, or any other PR I make. This includes any related work like research.
@ShoyuVanilla

ShoyuVanilla commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Yeah, I saw them and actually expected that this could be a perf improvement because of them, but looks like we have some subtlties that regressing this. But given that your fine grained accesses negates them and you are going to improve this further the perf regressions feel okayish to me (anyway, we are gonna deprecate the old solver eventually 😁)

rust-bors Bot pushed a commit that referenced this pull request Nov 5, 2026
Rollup of 13 pull requests

Successful merges:

 - #163477 (Fancy paramenv accessors that communicate the access pattern better.)
 - #160593 (turn ABI-controlling target features into a target modifier)
 - #164896 (offload: pass the linked device image to the host pass)
 - #165468 (Remove return type from `BuilderMethods::store`)
 - #159374 (Lower #[no_mangle] to #[symbol_name]/#[link_name])
 - #164564 (Re-enable outline-atomics by default on more AArch64 platforms)
 - #164623 (add next-solver regression tests for two fixed ices)
 - #164678 (add next-solver regression test for recursive opaque ICE under validate-mir)
 - #165429 (Add tests for `-Zcrate-attr` edition and position)
 - #165430 ([tiny] Show context for found assoc item in E0107)
 - #165456 (std: Fix build for the L4Re targets)
 - #165463 (Add BTreeMap::allocator and BTreeSet::allocator)
 - #165466 (Don't "exit" using `panic` on teeos)
rust-bors Bot pushed a commit that referenced this pull request Nov 5, 2026
Rollup of 15 pull requests

Successful merges:

 - #163477 (Fancy paramenv accessors that communicate the access pattern better.)
 - #160593 (turn ABI-controlling target features into a target modifier)
 - #164896 (offload: pass the linked device image to the host pass)
 - #165468 (Remove return type from `BuilderMethods::store`)
 - #164564 (Re-enable outline-atomics by default on more AArch64 platforms)
 - #164623 (add next-solver regression tests for two fixed ices)
 - #164653 (Deprecate internal function `vec::from_elem`)
 - #164678 (add next-solver regression test for recursive opaque ICE under validate-mir)
 - #165387 (windows OpenOptionsExt examples: replace winapi by windows crate)
 - #165429 (Add tests for `-Zcrate-attr` edition and position)
 - #165430 ([tiny] Show context for found assoc item in E0107)
 - #165456 (std: Fix build for the L4Re targets)
 - #165463 (Add BTreeMap::allocator and BTreeSet::allocator)
 - #165466 (Don't "exit" using `panic` on teeos)
 - #165491 (Remove unused compiler types and associated helpers)
@rust-bors
rust-bors Bot merged commit 8baab12 into rust-lang:main Nov 5, 2026
15 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Nov 5, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 5, 2026
Rollup merge of #163477 - jdonszelmann:paramenv-accessors, r=ShoyuVanilla

Fancy paramenv accessors that communicate the access pattern better.

r? @lcnr or @rust-lang/initiative-trait-system-refactor

This is a single commit, to precede the future change of "compressed trait clauses". It adds a lot of the infrastructure, without making any real changes that may affect performance. As such it forms a separately reviewable step. Even though this isn't on its own such a useful change, it mostly refactors things, it does still make for a nicer API surface.

Importantly, with compressed trait clauses (i.e. encoding some common traits as `where self_ty : <bitset of common traits>`), it becomes very important to be careful with how we iterate over caller bounds. I've tried other methods, but the typestate API (as proposed in this PR) is the only one I've found that's both ergonomic, and still allows for implementing compressed trait clauses performantly.

> [!NOTE]
> I've not used an LLM for any part of this PR, or any other PR I make. This includes any related work like research.
@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 (68cd6ad): comparison URL.

Overall result: ❌ regressions - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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.8% [0.2%, 1.3%] 17
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.8% [0.2%, 1.3%] 17

Max RSS (memory usage)

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

Cycles

Results (primary 2.7%)

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

mean range count
Regressions ❌
(primary)
2.7% [2.4%, 2.9%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.7% [2.4%, 2.9%] 5

Binary size

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

Artifact size: 406.29 MiB -> 406.33 MiB (0.01%)

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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants