Skip to content

Heap closures can capture already-moved values. #7619

Closed
@bblum

Description

@bblum

I must say I am shocked that this program is accepted. You can imagine what happens.

fn main () {
        let x = ~"hello";
        let _y = x;
        let z: ~fn() = || { error!("%?", x); }; // program accepted with @fn or ~fn but not &fn
        z();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions