E0106lifetime

Missing lifetime specifier

A reference appears in a position where the compiler can't infer its lifetime.

Repro

struct Wrap { name: &str }   // E0106: missing lifetime specifier
fn from_two(a: &str, b: &str) -> &str { a }   // E0106: ambiguous output

Why

Elision rules don't apply: structs need explicit lifetimes for reference fields, and functions with multiple input references can't auto-tie an output to one specific input.

Fix

- Annotate struct fields:

  struct Wrap<'a> { name: &'a str }
  

- Bind the output to one input lifetime explicitly:

  fn from_two<'a>(a: &'a str, b: &str) -> &'a str { a }
  

- Often simpler: own the data — struct Wrap { name: String } avoids lifetimes entirely.

Patterns that solve this