-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Conversation
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. |
fn main() { | ||
let mut value = 3; | ||
let _borrow = &mut value; | ||
let _sum = value + value; // error: cannot use `value` because |
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.
This line might mislead users. Please replace it with:
let _sum = value + 1;
A few things to correct and it should be good! |
@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. |
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 value was used after it was mutably borrowed."
A few other updates to be done. After they're done, please squash your commits. You should have one commit for each error explanation. |
@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? |
No no, one PR is fine. Let me take a last look. |
``` | ||
fn main() { | ||
let mut value = 3; | ||
let value_cloned = value.cloned(); |
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 didn't annotate this example. Please do it.
Just one last little change and it should be good! |
3a9aaba
to
5439806
Compare
All good. Thanks @m-decoster! @bors: r+ rollup |
📌 Commit 5439806 has been approved by |
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.
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.
⌛ Testing commit 5439806 with merge aa3adea... |
⛄ The build was interrupted to prioritize another pull request. |
⌛ Testing commit 5439806 with merge df206f3... |
💔 Test failed - auto-linux-64-opt-rustbuild |
fn main() { | ||
let mut value = 3; | ||
// We clone `value`, creating a copy. | ||
let value_cloned = value.cloned(); |
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 damn, clone
and not cloned
!
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 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
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.
Yes.
Should compile now. |
@bors: r+ rollup |
📌 Commit e06fbe1 has been approved by |
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.
(cannot use
..
because it was mutably borrowed, cannot move out of type..
, a non-copy fixed-size array)Part of #32777.