-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Explained asterisk on & and &mut reference #27566
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pcwalton (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. 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. |
@@ -125,6 +125,10 @@ This will print `6`. We make `y` a mutable reference to `x`, then add one to | |||
the thing `y` points at. You’ll notice that `x` had to be marked `mut` as well, | |||
if it wasn’t, we couldn’t take a mutable borrow to an immutable value. | |||
|
|||
You'll also notice we added an asterisk in front of `y`, making it `*y`, | |||
this is because y is an `&mut` reference. You'll also need to use them for |
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 y
should have graves as well, so it looks like code.
A few tiny nits! Thanks again for catching this and sending a PR in. |
@bors: r+ rollup |
📌 Commit d3e089f has been approved by |
I got a bit confused reading the guide over why all of a sudden there was an asterisk in the code. I was explained what it was there for in the IRC, and I think it should added it to the docs to prevent any further confusion!
I got a bit confused reading the guide over why all of a sudden there was an asterisk in the code. I was explained what it was there for in the IRC, and I think it should added it to the docs to prevent any further confusion!