Skip to content

Conversation

@Zalathar
Copy link
Member

Currently, thir::PatKind::Deref is used for ordinary &/&mut patterns, and also for &pin const and &pin mut patterns under feature(pin_ergonomics). The only way to distinguish between them is by inspecting the Ty attached to the pattern node.

That's non-obvious, making it easy to miss, and is also a bit confusing to read when it does occur.

This PR therefore adds an explicit pin: hir::Pinnedness field to thir::PatKind::Deref, to explicitly distinguish pin-deref nodes from ordinary builtin-deref nodes.

(I'm not deeply familiar with the future of pin-patterns, so I'm not sure whether that information is best carried as a field or as a separate PatKind, but I think this approach is at least an improvement over the status quo.)

r? Nadrieril (or compiler)

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

rustbot commented Jan 18, 2026

Some changes occurred in match checking

cc @Nadrieril

Some changes occurred in exhaustiveness 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 Jan 18, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 18, 2026

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