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

Proc lifetime bug #11925

Closed
bvssvni opened this issue Jan 30, 2014 · 5 comments · Fixed by #12738
Closed

Proc lifetime bug #11925

bvssvni opened this issue Jan 30, 2014 · 5 comments · Fixed by #12738
Labels
A-lifetimes Area: Lifetimes / regions A-type-system Area: Type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@bvssvni
Copy link

bvssvni commented Jan 30, 2014

fn main() {
    let r = {
        let x = 42;
        let f = proc() &x;
        f()
    };

    // Prints out '&1', but should give a compiler error 'borrowed value does not live long enough'.
    println!("{:?}", r);
}
@lilyball
Copy link
Contributor

This can segfault too, if you change what x is.

fn main() {
    let r = {
        let x = ~42;
        let f = proc() &x;
        f()
    };

    println!("{:?}", r);
}

cc @nikomatsakis

@zr40
Copy link
Contributor

zr40 commented Jan 30, 2014

Might be related to #10398.

@nikomatsakis
Copy link
Contributor

I'll take a look.

@alexcrichton
Copy link
Member

This has been fixed, flagging as needstest.

bors added a commit that referenced this issue Mar 6, 2014
Closes #6738
Closes #7061
Closes #7899
Closes #9719
Closes #10028
Closes #10228
Closes #10401
Closes #11192
Closes #11508
Closes #11529
Closes #11873
Closes #11925
@flaper87
Copy link
Contributor

flaper87 commented Mar 7, 2014

a small description in the test files explaining what the test does would have been nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: Lifetimes / regions A-type-system Area: Type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants