Skip to content

Unary move breaks linearity when moving out of enums #3082

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 Aug 1, 2012 · 2 comments
Closed

Unary move breaks linearity when moving out of enums #3082

bblum opened this issue Aug 1, 2012 · 2 comments
Labels
A-lifetimes Area: Lifetimes / regions 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 Aug 1, 2012

This code compiles and runs the destructor twice:

class noncopyable {
    i: (); new() { self.i = (); } drop { #error["dropped"]; }
}
enum wrapper = noncopyable;

fn main() {
    let x1 = wrapper(noncopyable());
    let x2 = move *x1;
}

If it's written let x2 <- *x1, it instead errors with error: moving out of enum content, which is perhaps what this should do too.

@bblum
Copy link
Contributor Author

bblum commented Aug 1, 2012

Given where that other compile error comes from, I think this is borrowck's job.

@nikomatsakis
Copy link
Contributor

dup of #3071 I believe

bors pushed a commit to rust-lang-ci/rust that referenced this issue May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: Lifetimes / regions 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