nomicon
nomicon copied to clipboard
Confused about lifetime
let x = 0;
let z;
let y = &x;
z = y;
'a: {
let x: i32 = 0;
'b: {
let z: &'b i32;
'c: {
// Must use 'b here because the reference to x is
// being passed to the scope 'b.
let y: &'b i32 = &'b x;
z = y;
}
}
}
Why mark y with 'b, but not z with 'c? Are there any references on lifetime eval?