Skip to content

Handle ref pin patterns in borrowck#6

Merged
frank-king merged 1 commit intofrank-king:feature/pin-borrowckfrom
P8L1:ref-pin-pattern-borrowck
May 3, 2026
Merged

Handle ref pin patterns in borrowck#6
frank-king merged 1 commit intofrank-king:feature/pin-borrowckfrom
P8L1:ref-pin-pattern-borrowck

Conversation

@P8L1
Copy link
Copy Markdown

@P8L1 P8L1 commented May 3, 2026

This follows up on the review comment from #5 asking for borrowck coverage for ref pin patterns.

The new tests showed that ref pin mut / ref pin const patterns were not being treated equivalently to direct &pin mut / &pin const borrows. With only the new tests kept and the implementation files reverted, the new diagnostics were missing.

This change makes pinned ref patterns lower to BorrowKind::Pinned(..., PinBorrowKind::Persistent), while preserving the existing behavior for ordinary non-pinned ref / ref mut patterns.

Added coverage for:

  • ref pin mut followed by a later &mut
  • ref pin mut followed by a later move
  • ref pin const followed by a later &mut
  • ref pin const followed by a later move
  • pinned projection cases
  • pinned parent / field cases
  • Unpin vs !Unpin behavior

@P8L1
Copy link
Copy Markdown
Author

P8L1 commented May 3, 2026

@frank-king This should address the remaining "ref pin" / borrowck coverage you requested in #5.

Since rust-lang#153693 is still draft and the "Test pin pattern matching" task is still open there, would you prefer to merge this follow-up into "feature/pin-borrowck" before you do the final self-review / mark the upstream PR ready for review?

No rush; just checking so I do not add noise in the upstream PR if you want this integrated first.

@frank-king frank-king merged commit a72c987 into frank-king:feature/pin-borrowck May 3, 2026
2 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants