-
Notifications
You must be signed in to change notification settings - Fork 10k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
hashmaps3 double borrow #1593
Comments
The compiler is smart enough to distinguish that entry1 is no longer being accessed and therefore allows entry2. After the line
You are no longer allowed to access entry1. For more info see https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html
|
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hello, I am new with Rust!
Trying to solve the exercise like this:
produces the following error:
which makes sense because I am borrowing 2 mutable references to scores entries. But when I permute the code like this
it compiles and pass the test.
Why this change make it work? I guess the compiler should not be able to distinguish that the entries are different by just looking at the code in both scenarios.
The text was updated successfully, but these errors were encountered: