Skip to content

Functional struct update allows copy of noncopyable values #7327

Closed
@bblum

Description

@bblum

This program segfaults when trying to run the destructor for "a". "b"'s destructor runs first and prints 2, then "a"'s destructor tries to access a zeroed-out ARC.

use extra::arc::*;
struct A { y: ARC<int>, x: ARC<int> }
impl Drop for A {
    fn finalize(&self) { println(fmt!("x=%?", self.x.get())); }
}
fn main() {
    let a = A { y: ARC(1), x: ARC(2) }; 
    let _b = A { y: ARC(3), ..a };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions