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 detailed error explanation for E0506 #33384

Merged
merged 1 commit into from
May 7, 2016
Merged

Conversation

cramertj
Copy link
Member

@cramertj cramertj commented May 3, 2016

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 @arielb1 (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.

}
```

If the value has to be borrowed, try limiting the lifetime of the borrow using
Copy link
Member

Choose a reason for hiding this comment

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

Or even a function (it might even be simpler to understand actually). Could you improve this example by adding a "function scope" (which does the same thing but whatever) please?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure what you mean by this. Are you saying to move the middle logic out into a separate function like this?

Copy link
Member

Choose a reason for hiding this comment

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

Just like your second example.

@cramertj
Copy link
Member Author

cramertj commented May 4, 2016

@GuillaumeGomez

E0506: r##"
This error occurs when an attempt is made to assign to a borrowed value.

For example:
Copy link
Member

Choose a reason for hiding this comment

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

It should "Example of erroneous code". Discussion here: #32989 (comment)

@GuillaumeGomez
Copy link
Member

Except for the last nit, it's all good. Please fix, squash and then it's good to get merged!

@bors
Copy link
Contributor

bors commented May 5, 2016

☔ The latest upstream changes (presumably #33376) made this pull request unmergeable. Please resolve the merge conflicts.

Broke up long lines in E0506

Trimmed E0506 comment to be under max line width

Added function example to E0506

Changed example of erroneous code wording on E0506
@GuillaumeGomez
Copy link
Member

All good for me! Thanks @cramertj!

r=me @steveklabnik @Manishearth

@arielb1
Copy link
Contributor

arielb1 commented May 7, 2016

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 7, 2016

📌 Commit 8facc97 has been approved by arielb1

steveklabnik added a commit to steveklabnik/rust that referenced this pull request May 7, 2016
Add detailed error explanation for E0506

Part of rust-lang#32777
steveklabnik added a commit to steveklabnik/rust that referenced this pull request May 7, 2016
Add detailed error explanation for E0506

Part of rust-lang#32777
bors added a commit that referenced this pull request May 7, 2016
@bors bors merged commit 8facc97 into rust-lang:master May 7, 2016
@cramertj cramertj deleted the E0506 branch May 25, 2016 19:56
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.

5 participants