-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-destructorsArea: Destructors (`Drop`, …)Area: Destructors (`Drop`, …)A-type-systemArea: Type systemArea: Type systemI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
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.
Metadata
Metadata
Assignees
Labels
A-destructorsArea: Destructors (`Drop`, …)Area: Destructors (`Drop`, …)A-type-systemArea: Type systemArea: Type systemI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.