1/6

A lifetime annotation does not make anything live longer. It is a constraint the caller must satisfy, and the compiler checks it at every call site.

fn longest<'a>(a: &'a str, b: &'a str) -> &'a str

Read it as a sentence about the caller, not about the function: "give me two references, and I will give you back one that is valid for as long as both of the inputs are."

Nothing is allocated. Nothing is extended. 'a is a name for a region of code, invented so the return value can be tied to an argument.