Skip to content

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

Closed
@kmcallister

Description

@kmcallister
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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions