Skip to content

Conversation

@Zalathar
Copy link
Member

While looking for improvements to match-lowering, I had been trying to figure out why pin-patterns sometimes use PatKind::Deref and sometimes use PatKind::DerefPattern, which seemed confusing to me. In particular, both pattern kinds are being used with an inner type of & or &mut, which is very surprising.

The conclusion I came to was that DerefPattern (normally associated with calls to Deref/DerefMut) was only being used for implicit pin-patterns produced by match-ergonomics adjustment, whereas Deref was being used for explicit pin-patterns.

The inconsistency seems like a mistake to me, so this PR removes all uses of DerefPattern for pin-patterns, and consistently uses PatKind::Deref for pin-patterns instead. I'm not entirely happy with that outcome, because I think pin-patterns should probably have their own thir::PatKind variant, but this change will at least make that easier to achieve in a later PR.

r? Nadrieril

@Zalathar Zalathar added the F-pin_ergonomics `#![feature(pin_ergonomics)]` label Dec 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 18, 2025

Some changes occurred in match checking

cc @Nadrieril

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 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 18, 2025

Nadrieril is not on the review rotation at the moment.
They may take a while to respond.

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

Labels

F-pin_ergonomics `#![feature(pin_ergonomics)]` 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants