Why are explicit lifetimes needed in Rust?

The other answers all have salient points (fjh’s concrete example where an explicit lifetime is needed), but are missing one key thing: why are explicit lifetimes needed when the compiler will tell you you’ve got them wrong? This is actually the same question as “why are explicit types needed when the compiler can infer them”. … Read more