Skip to content

Structs initialised with new syntax don't run destructors. #3172

@bblum

Description

@bblum
struct foo {
    x: ~str;
    drop { #error["%s", self.x]; }
}

fn main() {
    let _z = foo { x: ~"Hello" };
}

This leaks x instead of printing it.

Metadata

Metadata

Assignees

Labels

A-destructorsArea: Destructors (`Drop`, …)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions