Skip to content

Conversation

@Zalathar
Copy link
Member

I've always found it confusing that this code uses the word “sort” to describe partitioning candidates into buckets, since it isn't sorting them in the usual sense.

This PR therefore renames the relevant methods:

  • sort_candidatespartition_candidates_into_buckets
  • sort_candidatechoose_bucket_for_candidate

In addition, this PR moves those methods into their own buckets module, updates some comments to reflect the renaming, and also makes partition_candidates_into_buckets return a named struct instead of a tuple.

There should be no change to compiler behaviour.

@rustbot
Copy link
Collaborator

rustbot commented Dec 13, 2025

Some changes occurred in match lowering

cc @Nadrieril

@rustbot rustbot 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. labels Dec 13, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 13, 2025

r? @saethlin

rustbot has assigned @saethlin.
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

@Nadrieril
Copy link
Member

Well bucket sort is a kind of sort :D But I agree your rename is an improvement, also big fan of renaming sorted_candidates to prior_candidates. Thanks!

r? Nadrieril

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 15, 2025

📌 Commit bc11e7e has been approved by Nadrieril

It is now in the queue for this repository.

@bors bors 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 Dec 15, 2025
bors added a commit that referenced this pull request Dec 15, 2025
Rollup of 7 pull requests

Successful merges:

 - #149744 (test: update duplicate many_digits test to use f64 instead of f32)
 - #149946 (mir_build: Move and rename code for partitioning match candidates)
 - #149987 (Move ambient cdb discovery from compiletest to bootstrap)
 - #149990 (Improve amdgpu docs: Mention device-libs and xnack)
 - #149994 (Allow vector types for amdgpu)
 - #149997 (Link POSIX instead of Linux manual for Instant)
 - #150010 (Correct library linking for hexagon targets in run-make tests)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 450694c into rust-lang:main Dec 15, 2025
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Dec 15, 2025
rust-timer added a commit that referenced this pull request Dec 15, 2025
Rollup merge of #149946 - Zalathar:buckets, r=Nadrieril

mir_build: Move and rename code for partitioning match candidates

I've always found it confusing that this code uses the word “sort” to describe partitioning candidates into buckets, since it isn't *sorting* them in the usual sense.

This PR therefore renames the relevant methods:
- `sort_candidates` → `partition_candidates_into_buckets`
- `sort_candidate` → `choose_bucket_for_candidate`

In addition, this PR moves those methods into their own `buckets` module, updates some comments to reflect the renaming, and also makes `partition_candidates_into_buckets` return a named struct instead of a tuple.

There should be no change to compiler behaviour.
@Zalathar Zalathar deleted the buckets branch December 15, 2025 20:59
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