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

Extraneous "lock" #3664

Closed
seishun opened this issue Jun 1, 2023 · 1 comment · Fixed by #3881
Closed

Extraneous "lock" #3664

seishun opened this issue Jun 1, 2023 · 1 comment · Fixed by #3881

Comments

@seishun
Copy link
Contributor

seishun commented Jun 1, 2023

  • I have searched open and closed issues and pull requests for duplicates, using these search terms:
    • lock counter
  • I have checked the latest main branch to see if this has already been fixed, in this file:
    • src/ch16-03-shared-state.md

URL to the section(s) of the book with this problem:
https://doc.rust-lang.org/stable/book/ch16-03-shared-state.html#sharing-a-mutext-between-multiple-threads

Description of the problem:

The error message states that the counter value was moved in the previous iteration of the loop. Rust is telling us that we can’t move the ownership of lock counter into multiple threads.

Suggested fix:

Drop the "lock".

chriskrycho added a commit that referenced this issue Apr 8, 2024
@chriskrycho
Copy link
Contributor

Agreed! I just opened #3881 to fix it (albeit a slightly different way).

chriskrycho added a commit that referenced this issue Apr 9, 2024
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

Successfully merging a pull request may close this issue.

2 participants