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

Unsoundness: free variable in proc can be consumed twice #13060

Closed
kmcallister opened this issue Mar 21, 2014 · 1 comment
Closed

Unsoundness: free variable in proc can be consumed twice #13060

kmcallister opened this issue Mar 21, 2014 · 1 comment

Comments

@kmcallister
Copy link
Contributor

use std::io;

fn make_proc() -> proc() {
    let s = ~"foo";
    proc() {
        drop(s);
        io::stderr().write_str(s).unwrap();
    }
}

fn main() {
    let p = make_proc();
    p();
}
$ rustc -v
rustc 0.10-pre (68a4f7d 2014-02-24 12:42:02 -0800)
host: x86_64-unknown-linux-gnu

$ rustc foo.rs
$ ./foo
Segmentation fault

(Apologies if this has already been fixed; I'm using Servo's rustc.)

@flaper87
Copy link
Contributor

Sounds like a duplicate of #12223

lnicola pushed a commit to lnicola/rust that referenced this issue Aug 23, 2022
feat: Improved inline_call to replace `Self`

Fixes rust-lang#13060
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

2 participants