Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confused about lifetime #442

Open
7lon7 opened this issue Mar 3, 2024 · 0 comments
Open

Confused about lifetime #442

7lon7 opened this issue Mar 3, 2024 · 0 comments

Comments

@7lon7
Copy link

7lon7 commented Mar 3, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant