Skip to content
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

Confusing move behavior #27656

Closed
zonyitoo opened this issue Aug 11, 2015 · 2 comments
Closed

Confusing move behavior #27656

zonyitoo opened this issue Aug 11, 2015 · 2 comments

Comments

@zonyitoo
Copy link

struct Foo {
    bar: u32,
}

fn main() {
    let mut foo = Foo { bar: 10 };
    let foo2 = foo; // <-- moved here

    foo.bar = 20; // <-- but still works!

    println!("{}", foo.bar); // <- failed because `foo` has been moved
}
@sfackler
Copy link
Member

This looks like a duplicate of #21232.

@Aatch
Copy link
Contributor

Aatch commented Aug 11, 2015

Agreed. Closing as duplicate of #21232

@Aatch Aatch closed this as completed Aug 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants