Skip to content

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

Merged
merged 1 commit into from
Jan 18, 2016
Merged

Add E0507 error explanation #30964

merged 1 commit into from
Jan 18, 2016

Conversation

GuillaumeGomez
Copy link
Member

@@ -293,6 +293,66 @@ let c = &i; // still ok!
```
"##,

E0507: r##"
You tried to move a borrowed content. Erroneous code example:
Copy link
Member

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.

@GuillaumeGomez GuillaumeGomez force-pushed the patch-5 branch 2 times, most recently from a12c90d to 0c6bc80 Compare January 17, 2016 13:22
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.
Copy link
Member

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)]).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, well saw!

@GuillaumeGomez
Copy link
Member Author

Updated.

@Manishearth
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jan 17, 2016

📌 Commit f15512e has been approved by Manishearth

@bors
Copy link
Collaborator

bors commented Jan 17, 2016

⌛ Testing commit f15512e with merge 758142a...

@bors
Copy link
Collaborator

bors commented Jan 17, 2016

💔 Test failed - auto-linux-64-nopt-t

@bluss
Copy link
Member

bluss commented Jan 17, 2016

@bors retry

@bors
Copy link
Collaborator

bors commented Jan 17, 2016

⌛ Testing commit f15512e with merge 4ab9a2d...

1 similar comment
@bors bors merged commit f15512e into rust-lang:master Jan 18, 2016
@GuillaumeGomez GuillaumeGomez deleted the patch-5 branch January 18, 2016 07:58
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 this pull request may close these issues.

4 participants