rust-pin-projectionlisted
Install: claude install-skill po4yka/rust-skills
# Rust pin projection
## Purpose
Decide whether `Pin` buys anything in your signature, then meet the obligations it creates.
This skill covers address-sensitive types, `Unpin`, `PhantomPinned`, the three ways to pin a
value, and pinning projection into a field, by hand and through the macro crates.
The sentence to not get wrong: `Pin<&mut T>` enforces nothing when `T: Unpin`, and `!Unpin` never
makes a type unmovable. The restriction starts at the pin, and only for a `!Unpin` type.
The skill stops at `Pin`. Polling and cancel safety belong to `rust-async-internals`. Miri
belongs to `rust-sanitizers-miri`. Every diagnostic and Miri transcript below comes from rustc
1.97.0, edition 2024, aarch64-apple-darwin, Miri on nightly, pin-project 1.1.13, and
pin-project-lite 0.2.17.
## Route the symptom to a section
| Symptom or task | Section |
| --- | --- |
| You are about to write `self: Pin<&mut Self>` | [Pin enforces nothing for an Unpin target](#pin-enforces-nothing-for-an-unpin-target) |
| `PhantomPinned`, or a claim that a type "cannot move" | [Unpin does not mean movable](#unpin-does-not-mean-movable) |
| `error[E0277]: PhantomPinned cannot be unpinned` | [Get a value pinned](#get-a-value-pinned) |
| `error[E0515]: cannot return value referencing temporary value`, at a `pin!` | [Get a value pinned](#get-a-value-pinned) |
| `error[E0382]: use of moved value`, `does not implement the Copy trait` | [Get a value pinned](#get-a-value-pinned) |
| Miri: `allocN has been freed, s