Skip to content

outline unreachable! from Clause::kind - #163657

Open
panstromek wants to merge 1 commit into
rust-lang:mainfrom
panstromek:next-solver-unreachable
Open

panstromek wants to merge 1 commit into
rust-lang:mainfrom
panstromek:next-solver-unreachable

Conversation

@panstromek

Copy link
Copy Markdown
Contributor

Safe alternative to #163639. unreachable!() expands to panic("internal error: entered unreachable code"), which we've seen before to be worse than plain argument-less call in other hot places.

see https://rust-lang.zulipchat.com/#narrow/channel/247081-t-compiler.2Fperformance/topic/needs.20help.3A.20small.20perf.20improvement.20with.20non-local.20reasoning/with/628660586

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

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 2, 2026
@rust-bors

rust-bors Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 2660fea (2660fea4cf8b7dcc478d2dc474f57411892974f5)
Base parent: c165834 (c1658342b0ea7eab61db1960082668c77f553522)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2660fea): 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 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
Improvements ✅
(primary)
-0.4% [-0.6%, -0.1%] 4
Improvements ✅
(secondary)
-0.4% [-0.7%, -0.2%] 34
All ❌✅ (primary) -0.4% [-0.6%, -0.1%] 4

Max RSS (memory usage)

Results (secondary 3.9%)

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

Cycles

Results (primary 2.4%, secondary 3.0%)

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

mean range count
Regressions ❌
(primary)
2.4% [2.1%, 2.7%] 2
Regressions ❌
(secondary)
3.0% [3.0%, 3.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.4% [2.1%, 2.7%] 2

Binary size

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

Bootstrap: 491.121s -> 490.2s (-0.19%)
Artifact size: 408.64 MiB -> 408.63 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 2, 2026
@panstromek
panstromek marked this pull request as ready for review October 2, 2026 16:53
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 2, 2026
@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 Oct 2, 2026
@rustbot

rustbot commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

r? @oli-obk

rustbot has assigned @oli-obk.
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, types
  • compiler, types expanded to 77 candidates
  • Random selection from 19 candidates

@panstromek

Copy link
Copy Markdown
Contributor Author

This is not as good as unreachable_unchecked but it's at least something.

}

pub fn kind(self) -> ty::Binder<'tcx, ClauseKind<'tcx>> {
#[cold]

@lcnr lcnr Oct 2, 2026 •

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.

can you put a comment here referencing this perf run, r=me after

View changes since the review

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.

Done, thanks ;) but I don't have r+ rights to approve this

@panstromek
panstromek force-pushed the next-solver-unreachable branch from a5d2421 to 1a98b21 Compare October 3, 2026 04:47
@rust-bors

This comment has been minimized.

unreachable!() expands to panic("internal error: entered unreachable code"), which makes the happy path perform worse than plain argument-less call.
@panstromek
panstromek force-pushed the next-solver-unreachable branch from 1a98b21 to 22f30e6 Compare October 3, 2026 06:32
@rustbot

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

@lcnr

lcnr commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

@bors r+ rollup=never

@rust-bors

rust-bors Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 22f30e6 has been approved by lcnr

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 Oct 3, 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

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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