mirror of
https://github.com/rust-lang/rust.git
synced 2026-01-24 23:17:31 +00:00
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)
For more information about how rustc works, see the rustc dev guide.