rust-pattern-semantics
Installation
SKILL.md
Rust Pattern Semantics
Analysis order
For the pattern that the question or the error names, determine:
- The crate edition and the MSRV (
rust-versioninCargo.toml). They decide which syntax compiles. See Version gates. - Whether the scrutinee is a place or a value expression.
- The alternatives of each or-pattern.
- The default binding mode at each nesting level.
- Whether each binding is by value,
ref, orref mut, and which fields a partial move leaves initialized. - When the guard runs, and whether it can run more than once.
- Where the scrutinee temporaries, the guard temporaries, and the bindings drop.
Do not propose a clone, a wildcard arm, or a ref keyword before this pass. Each one can
compile and change what the code moves, borrows, or matches.