Skip to content

Implement a new flag -Zdisable-fast-paths in trait solving - #156172

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
ShoyuVanilla:slowbro
May 5, 2026
Merged

Implement a new flag -Zdisable-fast-paths in trait solving#156172
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
ShoyuVanilla:slowbro

Conversation

@ShoyuVanilla

Copy link
Copy Markdown
Member

@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@rustbotrustbot 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels May 5, 2026

@lcnrlcnr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice, r=me after nit

View changes since this review

themselves (default: no)"),
direct_access_external_data: Option<bool> = (None, parse_opt_bool, [TRACKED],
"Direct or use GOT indirect to reference external data symbols"),
disable_fast_paths: bool = (false, parse_bool, [UNTRACKED],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i think this in theory impacts behavior, so it should be TRACKED 🤔

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah, right. I actually got some codes failing to compile with the flags due to the overflow since we don't do compute_goal_fast_path with it but goes into the nested goals

@ShoyuVanilla

Copy link
Copy Markdown
MemberAuthor

@bors r=lcnr

@rust-bors

rust-borsBot commented May 5, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 4432f6b has been approved by lcnr

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 May 5, 2026
rust-borsBot pushed a commit that referenced this pull request May 5, 2026
…uwer
Rollup of 7 pull requests
Successful merges:
- #156014 (resolve: Catch "cannot reexport" errors from macros 2.0 better)
- #156058 (Print HRTB binders before fn qualifiers)
- #156172 (Implement a new flag `-Zdisable-fast-paths` in trait solving)
- #156184 (Revert "remove `MethodReceiverExpr` special-casing")
- #155957 (Revert const hacks and use const closures in std)
- #156127 (Update `askama` version to `0.16.0`)
- #156183 (Remove duplicate debug assert)
rust-borsBot pushed a commit that referenced this pull request May 5, 2026
…uwer
Rollup of 7 pull requests
Successful merges:
- #156014 (resolve: Catch "cannot reexport" errors from macros 2.0 better)
- #156058 (Print HRTB binders before fn qualifiers)
- #156172 (Implement a new flag `-Zdisable-fast-paths` in trait solving)
- #156184 (Revert "remove `MethodReceiverExpr` special-casing")
- #155957 (Revert const hacks and use const closures in std)
- #156127 (Update `askama` version to `0.16.0`)
- #156183 (Remove duplicate debug assert)
rust-borsBot pushed a commit that referenced this pull request May 5, 2026
…uwer
Rollup of 7 pull requests
Successful merges:
- #156014 (resolve: Catch "cannot reexport" errors from macros 2.0 better)
- #156058 (Print HRTB binders before fn qualifiers)
- #156172 (Implement a new flag `-Zdisable-fast-paths` in trait solving)
- #156184 (Revert "remove `MethodReceiverExpr` special-casing")
- #155957 (Revert const hacks and use const closures in std)
- #156127 (Update `askama` version to `0.16.0`)
- #156183 (Remove duplicate debug assert)
@rust-bors
rust-borsBot merged commit b503949 into rust-lang:mainMay 5, 2026
11 checks passed
@rustbotrustbot added this to the 1.97.0 milestone May 5, 2026
rust-timer added a commit that referenced this pull request May 5, 2026
Rollup merge of #156172 - ShoyuVanilla:slowbro, r=lcnr
Implement a new flag `-Zdisable-fast-paths` in trait solving
Discussion: [#t-types/trait-system-refactor > ask for help @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/ask.20for.20help/near/583953725)
r? lcnr
@ShoyuVanilla
ShoyuVanilla deleted the slowbro branch May 6, 2026 00:02
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 6cebd3e

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (6cebd3e): 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
@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.

meanrangecount
Regressions ❌
(primary)
0.1%[0.1%, 0.1%]2
Regressions ❌
(secondary)
0.8%[0.2%, 1.5%]22
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)0.1%[0.1%, 0.1%]2

Max RSS (memory usage)

Results (secondary -0.6%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.6%[-0.6%, -0.6%]1
All ❌✅ (primary)--0

Cycles

Results (secondary -0.3%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.4%[0.4%, 0.4%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.6%[-0.7%, -0.5%]2
All ❌✅ (primary)--0

Binary size

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

Bootstrap: 495.494s -> 495.573s (0.02%)
Artifact size: 394.42 MiB -> 394.43 MiB (0.00%)

@rustbotrustbot added the perf-regression Performance regression. label May 8, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member

Caused the regression in
#156190

@lqd

lqd commented May 8, 2026

Copy link
Copy Markdown
Member

why is the old solver impacted? 🤔

@ShoyuVanilla

Copy link
Copy Markdown
MemberAuthor

This flag also affects some old solver optimization routines. But anyway, it's surprising that this impacts the perf in non-negligible amounts 🤔
Maybe having this impacts some optimizations like branch prediction. I'll try some experiments with that hypothesis

ChayimFriedman2 pushed a commit to ChayimFriedman2/rust-analyzer that referenced this pull request May 11, 2026
…uwer
Rollup of 7 pull requests
Successful merges:
- rust-lang/rust#156014 (resolve: Catch "cannot reexport" errors from macros 2.0 better)
- rust-lang/rust#156058 (Print HRTB binders before fn qualifiers)
- rust-lang/rust#156172 (Implement a new flag `-Zdisable-fast-paths` in trait solving)
- rust-lang/rust#156184 (Revert "remove `MethodReceiverExpr` special-casing")
- rust-lang/rust#155957 (Revert const hacks and use const closures in std)
- rust-lang/rust#156127 (Update `askama` version to `0.16.0`)
- rust-lang/rust#156183 (Remove duplicate debug assert)
rust-borsBot pushed a commit that referenced this pull request Jun 9, 2026
…=BoxyUwU,lcnr
obligations_for_self_ty: skip irrelevant goals (recompute sub_root from stalled_vars)
Supersedes [#146759](#146759). Since the original PR is having conflict now, I've rebased.
This includes 2 commit
1. the original one with rebase
2. above that, I've changed:
```
if stalled_on is Some: ignore sub_roots -> walk stalled_vars -> re-evaluate sub_root else: same with this PR
```
Why:
cached sub_roots can be stale if there is a sub-unification merge after stalling ([lcnr proposed on the original PR](#146759 (comment)))
so re-evaluating when reads ---> so more conservative
Testing:
* next-solver / traits tests
* we can follow after merging #156172 with -Zdisable-fast-paths
Style question:
In my preference, inside filter, I used filter_map - matches, but do you prefer if-let chain?
Original author: [lcnr](https://github.com/lcnr) [#146759](#146759)
r? @lcnr
ghaaj pushed a commit to ghaaj/polygrammar that referenced this pull request Aug 7, 2026
…uwer
Rollup of 7 pull requests
Successful merges:
- rust-lang/rust#156014 (resolve: Catch "cannot reexport" errors from macros 2.0 better)
- rust-lang/rust#156058 (Print HRTB binders before fn qualifiers)
- rust-lang/rust#156172 (Implement a new flag `-Zdisable-fast-paths` in trait solving)
- rust-lang/rust#156184 (Revert "remove `MethodReceiverExpr` special-casing")
- rust-lang/rust#155957 (Revert const hacks and use const closures in std)
- rust-lang/rust#156127 (Update `askama` version to `0.16.0`)
- rust-lang/rust#156183 (Remove duplicate debug assert)
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
…uwer
Rollup of 7 pull requests
Successful merges:
- rust-lang/rust#156014 (resolve: Catch "cannot reexport" errors from macros 2.0 better)
- rust-lang/rust#156058 (Print HRTB binders before fn qualifiers)
- rust-lang/rust#156172 (Implement a new flag `-Zdisable-fast-paths` in trait solving)
- rust-lang/rust#156184 (Revert "remove `MethodReceiverExpr` special-casing")
- rust-lang/rust#155957 (Revert const hacks and use const closures in std)
- rust-lang/rust#156127 (Update `askama` version to `0.16.0`)
- rust-lang/rust#156183 (Remove duplicate debug assert)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regressionPerformance regression.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@ShoyuVanilla@rustbot@JonathanBrouwer@rust-timer@lqd@lcnr