Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bblum opened this issue Aug 10, 2012 · 0 comments
Closed

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

bblum opened this issue Aug 10, 2012 · 0 comments
Assignees
Labels
A-destructors Area: Destructors (`Drop`, …)

Comments

@bblum
Copy link
Contributor

bblum commented Aug 10, 2012

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

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

This leaks x instead of printing it.

@ghost ghost assigned pcwalton Aug 10, 2012
bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
trim the start of a line when wrapping an item in preparation for formatting
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Dependency upgrade resulting from `cargo update`.

Co-authored-by: tautschnig <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-destructors Area: Destructors (`Drop`, …)
Projects
None yet
Development

No branches or pull requests

2 participants