Closed
Description
EDIT(bblum): modernized the example
extern mod extra;
use extra::arc;
struct Bar { x: arc::ARC<()> }
impl Drop for Bar {
fn finalize(&self) {
error!("%?", self.x.get());
}
}
struct Foo { x: Bar }
fn main() {
let x = ~Foo { x: Bar { x: arc::ARC(()) } };
let ~Foo { x: _y } = x;
}
This runs the destructor twice and crashes. It does not run the destructor twice if the ~
are removed.
Unlike #3218, this code should compile, because A is the one with the destructor.