-
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
In std:rc, clarify the lack of mutability inside an Rc #39299
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @BurntSushi (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. |
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.
Few nits.
src/liballoc/rc.rs
Outdated
//! [`RefCell`]. | ||
//! Shared references in Rust disallow mutation by default, and `Rc` | ||
//! is no exception: you cannot obtain a mutable reference to | ||
//! something inside an `Rc`. If you need mutability, put a [`Cell`] |
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.
Extra whitespace before "if you need mutability".
src/liballoc/rc.rs
Outdated
//! Shared references in Rust disallow mutation by default, and `Rc` is no | ||
//! exception. If you need to mutate through an [`Rc`], use [`Cell`] or | ||
//! [`RefCell`]. | ||
//! Shared references in Rust disallow mutation by default, and `Rc` |
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.
`Rc`
should be [`Rc`]
.
src/liballoc/rc.rs
Outdated
//! [`RefCell`]. | ||
//! Shared references in Rust disallow mutation by default, and `Rc` | ||
//! is no exception: you cannot obtain a mutable reference to | ||
//! something inside an `Rc`. If you need mutability, put a [`Cell`] |
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.
`Rc`
should be [`Rc`]
.
Just a few nits and it'll be good! |
Pushed an extra commit to de-nitify. |
src/liballoc/rc.rs
Outdated
@@ -214,6 +216,7 @@ | |||
//! [upgrade]: struct.Weak.html#method.upgrade | |||
//! [`None`]: ../../std/option/enum.Option.html#variant.None | |||
//! [assoc]: ../../book/method-syntax.html#associated-functions | |||
//! [introducing-mutability]: ../../std/cell/index.html#introducing-mutability-inside-of-something-immutable |
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 is longer than 100 characters so tidy fails.
Once your tidy issue has been fixed, please squash your commits. |
Also, point to the example in Cell's docs for how to do it.
I've pushed a squashed version. This also has a shortened link name so the line in the references doesn't exceed 100 chars :-P |
Thanks! @bors: r+ rollup |
📌 Commit 4a07e72 has been approved by |
…laumeGomez In std:rc, clarify the lack of mutability inside an Rc Also, point to the example in Cell's docs for how to do it.
Also, point to the example in Cell's docs for how to do it.