Skip to content

Rip out old solver coherence - #161491

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
sjwang05:no-old-coherence
Oct 4, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
sjwang05:no-old-coherence

Conversation

@sjwang05

@sjwang05 sjwang05 commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

cc #t-types/call-for-participation > rip out old solver coherence support

Probably best reviewed commit-by-commit with ignore-whitespace.

#160668 replaced the last remaining place where old solver was still used by default in coherence with new solver. This PR removes code that was only used during coherence by the old solver, so now new-solver coherence is the only way to do coherence. So we don't confuse users, passing -Znext-solver=coherence and =no now do the exact same thing.

We also remove tracking intercrate ambiguity causes, since afaict the new solver uses a completely different path.

Everything else is either removing code that is now unreachable, or removing a condition that is now always true.

r? lcnr

@rustbot

rustbot commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in src/tools/compiletest

cc @jieyouxu

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

cc @BoxyUwU, @tshepang

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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 Aug 22, 2026
selcx: &mut SelectionContext<'cx, 'tcx>,
#[instrument(level = "debug", skip(infcx), ret)]
fn impl_intersection_has_impossible_obligation<'a, 'tcx>(
infcx: &InferCtxt<'tcx>,

@sjwang05 sjwang05 Aug 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The selcx was only ever used with the old solver, hence we just pass the infcx directly now.

View changes since the review

@rustbot

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

miri is developed in its own repository. If the Miri part of this change can be broken out, consider making this change to rust-lang/miri instead. However, if Miri needs adjusting for rustc changes, just ignore this message.

cc @rust-lang/miri

@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Aug 22, 2026
@rustbot

This comment has been minimized.

Comment thread compiler/rustc_session/src/options.rs Outdated
@rust-bors

This comment has been minimized.

Comment thread compiler/rustc_session/src/config.rs Outdated
Comment thread compiler/rustc_trait_selection/src/traits/select/mod.rs
@sjwang05
sjwang05 force-pushed the no-old-coherence branch 2 times, most recently from 2214e92 to 9f68a1b Compare August 26, 2026 08:08
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

Comment thread compiler/rustc_interface/src/tests.rs Outdated
Comment thread compiler/rustc_session/src/config.rs Outdated
Comment thread compiler/rustc_session/src/options.rs Outdated
rust-bors Bot pushed a commit that referenced this pull request Oct 4, 2026
Rollup of 18 pull requests

Successful merges:

 - #158102 (When compiling without a specified `--edition`, emit a message)
 - #162761 (Lower attributes for functions without bodies)
 - #163161 (implement FCW for `rustc_allowed_through_unstable_modules` items)
 - #163613 (Tweak the rendering of "not general enough" errors on the old trait solver)
 - #162062 (core: fix the docs of PanicInfo::location)
 - #163140 (document safety requirements for atomic intrinsics)
 - #163342 (Don't imply incorrect things about `Global` in the docs of `System`)
 - #163445 (Add safety comments for alloc::str)
 - #163503 (Mark Rc strong/weak count methods must_use)
 - #163548 (fs::set_permissions_nofollow: Android support, test cleanup)
 - #163585 ([triagebot] Create `debugger_visualizer` assign group)
 - #163597 (Add `SplitPathsRef` implementation for motor to make std build)
 - #163602 (Move media & home dirs tests to fs tests.)
 - #163667 (Finalize changes on expect messages for library/core/src/fmt/mod.rs)
 - #163682 ([rustdoc] Correctly link to (imported) enum variants with "jump to def")
 - #163683 (Fix GCC codegen backend comment in bootstrap)
 - #163703 (Move more `rustdoc-html tests` in the right location)
 - #163725 (some crashes fixed with next-solver)

Failed merges:

 - #161491 (Rip out old solver coherence)
@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 4, 2026
@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Oct 4, 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.

@sjwang05

sjwang05 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@bors r=khyperia

this time, surely.

@rust-bors

rust-bors Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 3a7efa2 has been tentatively approved by khyperia

It will be put into the queue for this repository once PR CI succeeds.

@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 4, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 4, 2026
Rip out old solver coherence

cc [#t-types/call-for-participation > rip out old solver coherence support](https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/rip.20out.20old.20solver.20coherence.20support/with/613938355)

Probably best reviewed commit-by-commit with ignore-whitespace.

rust-lang#160668 replaced the last remaining place where old solver was still used by default in coherence with new solver. This PR removes code that was only used during coherence by the old solver, so now new-solver coherence is the *only* way to do coherence. So we don't confuse users, passing `-Znext-solver=coherence` and `=no` now do the exact same thing.

We also remove tracking intercrate ambiguity causes, since afaict the new solver uses a completely different path.

Everything else is either removing code that is now unreachable, or removing a condition that is now always true.

r? lcnr
rust-bors Bot pushed a commit that referenced this pull request Oct 4, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #161491 (Rip out old solver coherence)
 - #163223 (regression test for async handler normalization ICE)
 - #163653 (callconv: mips64: Match GCC for alignment of 16-byte scalars)
 - #163742 (Add the `movdir64b` and `movdiri` x86 target features)
 - #163752 (Revert "implement PartialEq<VecDeque<U>> for Vec<T>, &[T], &mut [T], [T; N], &[T; N] and &mut [T; N]")
 - #163755 (fix -Z track-diagnostics for errors and lints emitted from rustc_attr_parsing)
@rust-bors

rust-bors Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

⌛ Testing commit 3a7efa2 with merge da0a774...

Workflow: https://github.com/rust-lang/rust/actions/runs/37226905815

rust-bors Bot pushed a commit that referenced this pull request Oct 4, 2026
Rip out old solver coherence





cc [#t-types/call-for-participation > rip out old solver coherence support](https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/rip.20out.20old.20solver.20coherence.20support/with/613938355)

Probably best reviewed commit-by-commit with ignore-whitespace.

#160668 replaced the last remaining place where old solver was still used by default in coherence with new solver. This PR removes code that was only used during coherence by the old solver, so now new-solver coherence is the *only* way to do coherence. So we don't confuse users, passing `-Znext-solver=coherence` and `=no` now do the exact same thing.

We also remove tracking intercrate ambiguity causes, since afaict the new solver uses a completely different path.

Everything else is either removing code that is now unreachable, or removing a condition that is now always true.

r? lcnr
@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors yield
Yielding to enclosing rollup

@rust-bors

rust-bors Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Auto build was cancelled. Cancelled workflows:

The next pull request likely to be tested is #163767.

rust-bors Bot pushed a commit that referenced this pull request Oct 4, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #161491 (Rip out old solver coherence)
 - #163533 (Run cg_gcc tests with the correct compiler)
 - #163223 (regression test for async handler normalization ICE)
 - #163367 (simplify rustc_log a bit)
 - #163622 (x86: c-variadic functions don't use registers with `-Zregparm`)
 - #163653 (callconv: mips64: Match GCC for alignment of 16-byte scalars)
 - #163665 (Parser: Refactor & better document `should_continue_as_assoc_expr` & `can_continue_expr_unambiguously`)
 - #163742 (Add the `movdir64b` and `movdiri` x86 target features)
 - #163752 (Revert "implement PartialEq<VecDeque<U>> for Vec<T>, &[T], &mut [T], [T; N], &[T; N] and &mut [T; N]")
@rust-bors
rust-bors Bot merged commit cd3e3d5 into rust-lang:main Oct 4, 2026
14 of 15 checks passed
rust-bors Bot pushed a commit that referenced this pull request Oct 4, 2026
Rollup merge of #161491 - sjwang05:no-old-coherence, r=khyperia

Rip out old solver coherence

cc [#t-types/call-for-participation > rip out old solver coherence support](https://rust-lang.zulipchat.com/#narrow/channel/618216-t-types.2Fcall-for-participation/topic/rip.20out.20old.20solver.20coherence.20support/with/613938355)

Probably best reviewed commit-by-commit with ignore-whitespace.

#160668 replaced the last remaining place where old solver was still used by default in coherence with new solver. This PR removes code that was only used during coherence by the old solver, so now new-solver coherence is the *only* way to do coherence. So we don't confuse users, passing `-Znext-solver=coherence` and `=no` now do the exact same thing.

We also remove tracking intercrate ambiguity causes, since afaict the new solver uses a completely different path.

Everything else is either removing code that is now unreachable, or removing a condition that is now always true.

r? lcnr
@rustbot rustbot added this to the 1.101.0 milestone Oct 4, 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 (8e00340): 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.5% [0.1%, 0.7%] 13
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [-0.1%, 0.7%] 15

Max RSS (memory usage)

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

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: missing data
Artifact size: 408.65 MiB -> 408.69 MiB (0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Oct 5, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member

This seems to have caused a perf regression, any idea why?

@panstromek

Copy link
Copy Markdown
Contributor

This looks like some kind of inlining difference to me, most of the diff comes from these two:

  Ir______________________________  function:file

>  157,186,026  (1670.7%, 1670.7%)  <rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation_no_cache:???

> -143,087,402 (-1520.8%,  149.8%)  <rustc_trait_selection::traits::select::SelectionContext>::assemble_candidates_from_impls:???

IIUC this touches some of the hot paths in obligation processing?

@khyperia

khyperia commented Oct 5, 2026

Copy link
Copy Markdown
Member

The diff to candidate_from_obligation_no_cache in this PR is just deleting fully dead code (a LOT of dead code, and code that I'm guessing is dead in a way the optimizer cannot actually see is dead). Yet, it's +1670.7%.

assemble_candidates_from_impls is practically untouched in this PR (changes an enum variant match arm to panic instead of continuing), yet has -1520.8% - it does call candidate_from_obligation_no_cache though (a couple layers deep),

My guess would be inlining shenanigans too, my understanding is this PR doesn't change any behavior whatsoever - just nuking dead code, adding unreachable panics in unreachable places instead of continuing, etc.

@JonathanBrouwer

Copy link
Copy Markdown
Member

changes an enum variant match arm to panic instead of continuing

This could increase code size, as a panic, especially one with a format str arg, is more instructions than a continue. This makes inlining less likely and worsens cache effiency.
Maybe this is related? This is just me theorizing

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

Labels

A-compiletest Area: The compiletest test runner A-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc A-tidy Area: The tidy tool 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. 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.

8 participants