Skip to content

Functional struct update allows copy of noncopyable values #7327

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

Closed
bblum opened this issue Jun 23, 2013 · 3 comments
Closed

Functional struct update allows copy of noncopyable values #7327

bblum opened this issue Jun 23, 2013 · 3 comments
Labels
A-type-system Area: Type system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@bblum
Copy link
Contributor

bblum commented Jun 23, 2013

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 };
}
@bblum
Copy link
Contributor Author

bblum commented Jun 23, 2013

where did the A-kindchk and A-linearity tags go?

nominating well-covered

@bblum
Copy link
Contributor Author

bblum commented Jul 12, 2013

It should really just desugar into

{ let mut old_thing = ...;
  old_thing.updated_field1 = expr1;
  ...;
  old_thing.updated_fieldN = exprN;
  old_thing }

@huonw
Copy link
Member

huonw commented Sep 2, 2013

Triage: appears to be fixed, test landing in #8932.

@huonw huonw closed this as completed in 12099ce Sep 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

2 participants