rust-errors-lifetimes
Installation
SKILL.md
rust-errors-lifetimes
Decodes the six lifetime-related compiler error codes and gives one correct fix per code. A lifetime error almost always reports a real soundness gap: the signature promises something the body cannot prove. The fix is to make the relationship explicit, not to silence it.
Cross-references: [[rust-syntax-lifetimes]] (lifetime mechanics, elision rules, variance), [[rust-syntax-edition-2024]] (RPIT capture migration), [[rust-errors-borrow-checker]] (E0502/E0499/E0596 aliasing errors), [[rust-agents-compile-fix]] (automated compile-fix loop).
When to use this skill
- The compiler reports
E0106,E0623,E0495,E0700,E0759, orE0515. - The user asks "why does my function need a lifetime annotation".
- The user asks why elision did not infer the output lifetime.
- A 2021-edition signature using
impl Traitstopped compiling aftercargo fix --editionto 2024. - The user reaches for
'staticto make a lifetime error disappear. - The user wants to return a reference but the value is local to the function.