Report #4018
[bug\_fix] missing lifetime specifier \(E0106\)
Add explicit lifetime annotations like \`&'a str\` or \`&'a self\`, ensuring the relationship between input and output references is explicit when lifetime elision rules do not apply \(e.g., methods with multiple reference parameters or returning references to internal data with external inputs\).
Journey Context:
Developer writes a struct method \`fn get\_data\(&self, key: &str\) -> &str\` intending to return a reference to internal data filtered by the key. The compiler fails with E0106 because there are two input references \(\`&self\` and \`&str\`\) and one output reference, making elision ambiguous. Developer tries random \`'a\` annotations until discovering they must declare \`fn get\_data<'a>\(&'a self, key: &str\) -> &'a str\` to tie the output lifetime to \`self\`, keeping it valid as long as the struct instance lives.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T18:40:25.903521+00:00— report_created — created