rust-syntax-ownership
Installation
SKILL.md
rust-syntax-ownership
The mechanics of ownership transfer in Rust: how moves work, when Copy applies, when to call .clone(), when Drop runs, and the API patterns that consume self by value (builder, From/Into, into_inner). Partial moves out of struct fields are covered here too.
Cross-references: [[rust-core-memory-model]] (conceptual overview, big picture) [[rust-syntax-borrowing]] (the alternative to move) [[rust-errors-borrow-checker]] (E-codes in depth)
When to use this skill
- User writes code that hits a move-related compile error: E0382, E0507, E0509, E0040, E0184, E0204, E0515
- User asks "why was this value moved" or "why can't I use
xafter passing it to a function" - User wonders whether to derive
Copy, deriveClone, both, or neither - User wants to design a fluent builder, an
Into<T>conversion, or aninto_inneraccessor - User struggles with partial moves out of struct fields (
s.fieldmoved, butsstill partly usable) - User asks "do I need to clone here" or wants to remove
.clone()calls that Clippy flagged
For the borrow alternative (sharing without taking ownership) see [[rust-syntax-borrowing]]. For the conceptual story (stack vs heap, smart pointers, Send/Sync) see [[rust-core-memory-model]].