-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Add E0507 error explanation #30964
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
Add E0507 error explanation #30964
Conversation
@@ -293,6 +293,66 @@ let c = &i; // still ok! | |||
``` | |||
"##, | |||
|
|||
E0507: r##" | |||
You tried to move a borrowed content. Erroneous code example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You tried to move out of a value which was borrowed.
a12c90d
to
0c6bc80
Compare
Here, the `nothing_is_true` method takes the ownership of `self`. However, | ||
`self` cannot be moved because `.borrow()` only provides an `&TheDarkKnight`, | ||
which is a borrow of the content owned by the `RefCell`. To fix this error, | ||
either try to avoid moving the variable or somehow reclaim the ownership. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A third option is to make the struct Copy
(the example should just add #[derive(Copy)]
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, well saw!
0c6bc80
to
f15512e
Compare
Updated. |
@bors r+ rollup |
📌 Commit f15512e has been approved by |
💔 Test failed - auto-linux-64-nopt-t |
@bors retry |
⌛ Testing commit f15512e with merge 4ab9a2d... |
r? @Manishearth