Lifetimes: References Cannot Outlive Data
When C developers first see lifetimes, it is easy to think they are annotations for “how long an object lives.”
That is not quite right.
Rust lifetimes are not runtime timers, and they are not manual descriptions of real object lifetime. They are static constraints the compiler uses to check reference relationships: a reference cannot outlive the data it points to.
C has the same problem. It is just checked by humans.
Read More