Skip to content

Instantly share code, notes, and snippets.

@ben0x539
Created November 17, 2012 19:49
Show Gist options
  • Save ben0x539/4099398 to your computer and use it in GitHub Desktop.
Save ben0x539/4099398 to your computer and use it in GitHub Desktop.
struct Foo {
x: int
}
impl Foo: Drop {
fn finalize() {
io::println(fmt!("drop: %?", ptr::to_unsafe_ptr(&self)));
}
}
fn main() {
let mut x = Foo { x: 2 };
io::println("before first drop");
x = Foo { x: 3 };
io::println("before second drop");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment