Skip to content

Unary move breaks linearity when moving out of enums #3082

Closed
@bblum

Description

@bblum

This code compiles and runs the destructor twice:

class noncopyable {
    i: (); new() { self.i = (); } drop { #error["dropped"]; }
}
enum wrapper = noncopyable;

fn main() {
    let x1 = wrapper(noncopyable());
    let x2 = move *x1;
}

If it's written let x2 <- *x1, it instead errors with error: moving out of enum content, which is perhaps what this should do too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regionsA-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