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

Add explanations for E0503 and E0508. #34133

Merged
merged 2 commits into from Jun 13, 2016
Merged

Conversation

m-decoster
Copy link
Contributor

@m-decoster m-decoster commented Jun 7, 2016

(cannot use .. because it was mutably borrowed, cannot move out of type .., a non-copy fixed-size array)

Part of #32777.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@m-decoster m-decoster changed the title Add explanation for E0503. Add explanations for E0503 and E0508. Jun 7, 2016
fn main() {
let mut value = 3;
let _borrow = &mut value;
let _sum = value + value; // error: cannot use `value` because
Copy link
Member

Choose a reason for hiding this comment

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

This line might mislead users. Please replace it with:

let _sum = value + 1;

@GuillaumeGomez
Copy link
Member

A few things to correct and it should be good!

@m-decoster
Copy link
Contributor Author

@GuillaumeGomez I have implemented your feedback.

@@ -633,6 +633,51 @@ fn main() {
```
"##,

E0503: r##"
This error occurs when a value is used after mutably borrowing it.
Copy link
Member

Choose a reason for hiding this comment

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

"A value was used after it was mutably borrowed."

@GuillaumeGomez
Copy link
Member

A few other updates to be done. After they're done, please squash your commits. You should have one commit for each error explanation.

@m-decoster
Copy link
Contributor Author

@GuillaumeGomez The commits should be squashed and ready to go. Do you prefer a separate pull request for both error explanations or is this fine as is?

@GuillaumeGomez
Copy link
Member

No no, one PR is fine. Let me take a last look.

```
fn main() {
let mut value = 3;
let value_cloned = value.cloned();
Copy link
Member

Choose a reason for hiding this comment

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

You didn't annotate this example. Please do it.

@GuillaumeGomez
Copy link
Member

Just one last little change and it should be good!

@m-decoster m-decoster force-pushed the master branch 2 times, most recently from 3a9aaba to 5439806 Compare June 8, 2016 06:50
@GuillaumeGomez
Copy link
Member

All good. Thanks @m-decoster!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jun 8, 2016

📌 Commit 5439806 has been approved by GuillaumeGomez

Manishearth added a commit to Manishearth/rust that referenced this pull request Jun 8, 2016
Add explanations for E0503 and E0508.

(cannot use `..` because it was mutably borrowed, cannot move out of type `..`, a non-copy fixed-size array)

Part of rust-lang#32777.
sanxiyn added a commit to sanxiyn/rust that referenced this pull request Jun 10, 2016
Add explanations for E0503 and E0508.

(cannot use `..` because it was mutably borrowed, cannot move out of type `..`, a non-copy fixed-size array)

Part of rust-lang#32777.
@bors
Copy link
Contributor

bors commented Jun 10, 2016

⌛ Testing commit 5439806 with merge aa3adea...

@bors
Copy link
Contributor

bors commented Jun 10, 2016

⛄ The build was interrupted to prioritize another pull request.

@bors
Copy link
Contributor

bors commented Jun 11, 2016

⌛ Testing commit 5439806 with merge df206f3...

@bors
Copy link
Contributor

bors commented Jun 11, 2016

💔 Test failed - auto-linux-64-opt-rustbuild

fn main() {
let mut value = 3;
// We clone `value`, creating a copy.
let value_cloned = value.cloned();
Copy link
Member

Choose a reason for hiding this comment

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

Oh damn, clone and not cloned!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't believe I mistyped that and then missed it and then forgot to run tests. Anyway, how exactly do I solve this now that you've already told bors to rollup? Do I just create a new commit and squash it again? @GuillaumeGomez

Copy link
Member

Choose a reason for hiding this comment

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

Yes.

@m-decoster
Copy link
Contributor Author

Should compile now.

@GuillaumeGomez
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jun 12, 2016

📌 Commit e06fbe1 has been approved by GuillaumeGomez

@bors
Copy link
Contributor

bors commented Jun 12, 2016

⌛ Testing commit e06fbe1 with merge 51d2d3d...

bors added a commit that referenced this pull request Jun 12, 2016
Add explanations for E0503 and E0508.

(cannot use `..` because it was mutably borrowed, cannot move out of type `..`, a non-copy fixed-size array)

Part of #32777.
@bors bors merged commit e06fbe1 into rust-lang:master Jun 13, 2016
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.

None yet

6 participants