Files
rust-lang/compiler/rustc_middle
Matthias Krüger a7249d87d8 Rollup merge of #151282 - Zalathar:pin-pat, r=Nadrieril
THIR patterns: Explicitly distinguish `&pin` from plain `&`/`&mut`

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)
2026-01-24 15:35:09 +01:00
..

For more information about how rustc works, see the rustc dev guide.