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

Closure fails to borrow its upvar, causing memory unsafety #11873

Closed
huonw opened this issue Jan 28, 2014 · 4 comments · Fixed by #12738
Closed

Closure fails to borrow its upvar, causing memory unsafety #11873

huonw opened this issue Jan 28, 2014 · 4 comments · Fixed by #12738
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@huonw
Copy link
Member

huonw commented Jan 28, 2014

fn main() {
    let mut v = ~[1];
    let f = || v.push(2);
    let _w = v; // should be illegal, `v` is borrowed by `f`

    f(); // boom
}

The above crashes with a segfault.

@huonw
Copy link
Member Author

huonw commented Jan 28, 2014

cc @nikomatsakis

@huonw
Copy link
Member Author

huonw commented Jan 28, 2014

Possibly related to/the same as #10398.

@nikomatsakis
Copy link
Contributor

cc #6801

@alexcrichton
Copy link
Member

This has been fixed, flagging as needstest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants