Skip to content

Passing an rvalue as ~self causes double-free #4355

Closed
@thestinger

Description

@thestinger

This somehow causes a destructor to be called twice:

struct Foo {
    data: ~[int]
}

impl Foo {
    fn bar(~self) -> ~Foo { self }
}

fn main() {
    (~Foo{data: ~[1,2,3]}).bar();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-destructorsArea: Destructors (`Drop`, …)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