Skip to content
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

Finalizer not run on tuple-like structs #4735

Closed
brson opened this issue Feb 1, 2013 · 4 comments
Closed

Finalizer not run on tuple-like structs #4735

brson opened this issue Feb 1, 2013 · 4 comments
Labels
A-codegen Area: Code generation

Comments

@brson
Copy link
Contributor

brson commented Feb 1, 2013

Leaks.

use core::cast::transmute;
use core::libc::c_void;

struct NonCopyable(*c_void);

impl NonCopyable: Drop {
    fn finalize(&self) {
        let p = **self;
        let v = unsafe { transmute::<*c_void, ~int>(p) };
    }
}

fn main() {
    let t = ~0;
    let p = unsafe { transmute::<~int, *c_void>(t) };
    let z = NonCopyable(p);
}

@graydon
Copy link
Contributor

graydon commented Mar 25, 2013

this got worse; it now ICEs with an 'assertion failed: adt::is_newtypeish(repr)'

@graydon
Copy link
Contributor

graydon commented Mar 25, 2013

non-critical for 0.6, de-milestoning

@catamorphism
Copy link
Contributor

Works now; I'll check in the test case.

@ghost ghost assigned catamorphism May 24, 2013
catamorphism added a commit to catamorphism/rust that referenced this issue May 28, 2013
@catamorphism
Copy link
Contributor

Test case checked in in 9a06ff0. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation
Projects
None yet
Development

No branches or pull requests

3 participants