Skip to content

Conversation

@Zalathar
Copy link
Member

@Zalathar Zalathar commented Dec 16, 2025

In the spirit of #149946, this is another renaming of something I've always found confusing.

When lowering match conditions, there is a subtle distinction between the kind of test being performed (on a scrutinee place), the possible outcomes of that test, and the different “cases” (corresponding to pattern nodes) that the test is distinguishing. Cases imply a particular preferred test, but once a test is chosen it can also interact with other cases as well.

I have often mixed up TestKind and TestCase, since the names are so similar, and they share several variant names. Therefore, this PR renames TestCase to TestableCase, to emphasise that these are the things selected by whatever test is being performed.

There should be no change to compiler behaviour.

@rustbot
Copy link
Collaborator

rustbot commented Dec 16, 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 16, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 16, 2025

r? @mati865

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

@rust-log-analyzer

This comment has been minimized.

Comment on lines -1264 to +1267
enum TestCase<'tcx> {
enum TestableCase<'tcx> {
Copy link
Member

Choose a reason for hiding this comment

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

For me TestableCase is more confusing than TestCase. I would prefer TestOutcome for example

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, my main motivation is to get rid of the Test prefix, because that's the part that keeps confusing me.

I think I would find TestOutcome even more confusing, because of TestBranch.

Copy link
Member

Choose a reason for hiding this comment

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

oh, fair point x)

@Nadrieril
Copy link
Member

r? me

@rustbot rustbot assigned Nadrieril and unassigned mati865 Dec 16, 2025
@Zalathar
Copy link
Member Author

Zalathar commented Dec 17, 2025

I would like to give this thing a better name, but I think it's only worth changing if we can agree on a new name that's clearly better.

So I would be fine with closing this for now, since it would conflict with some other simplifications/improvements that I'm investigating.

@Nadrieril
Copy link
Member

I can live with TestableCase. The Or and Deref variants prevent other names I thought of, this is just a confusing enum in general honestly. If this helps you, let's do this.

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 17, 2025

📌 Commit 7f6f522 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 17, 2025
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.

6 participants