Lifetimes in Rust
Introduction
Lifetimes as the name says is how long references in Rust are active.
fn main() {
let r;
{
let x = 5;
r = &x;
}
println!("r: {}", r);
}
Error:
error[E0597]: `x` does not live long enough
--> src/main.r...
diptobiswas.hashnode.dev4 min read