-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
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 |
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.
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?
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.
I'm not sure what you mean by this. Are you saying to move the middle logic out into a separate function like this?
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.
Just like your second example.
E0506: r##" | ||
This error occurs when an attempt is made to assign to a borrowed value. | ||
|
||
For 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.
It should "Example of erroneous code". Discussion here: #32989 (comment)
Except for the last nit, it's all good. Please fix, squash and then it's good to get merged! |
☔ 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
All good for me! Thanks @cramertj! |
@bors r+ rollup |
📌 Commit 8facc97 has been approved by |
Add detailed error explanation for E0506 Part of rust-lang#32777
Add detailed error explanation for E0506 Part of rust-lang#32777
Part of #32777