-
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
RefCell: document panics in Clone, PartialEq, PartialOrd, Ord. #48365
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Re-assigning to a T-doc member =) |
@steveklabnik ping from the release team! |
src/libcore/cell.rs
Outdated
@@ -880,6 +883,9 @@ impl<T:Default> Default for RefCell<T> { | |||
|
|||
#[stable(feature = "rust1", since = "1.0.0")] | |||
impl<T: ?Sized + PartialEq> PartialEq for RefCell<T> { | |||
/// # Panics | |||
/// | |||
/// Panics if the value is currently mutably borrowed. |
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.
For the functions that take an other
like this one, what do you think about using this wording:
Panics if the value in either
RefCell
is currently borrowed.
This wording is taken from RefCell::swap
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.
Sounds like a great improvement 👍
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.
r=me after changing to @frewsxcv 's wording; consistency is important and i think it's slightly clearer. Thanks so much for this PR!
@steveklabnik: Will do in a jiffy =) |
And fixed. |
@bors r+ rollup thanks! |
📌 Commit f8ebb3f has been approved by |
…s, r=frewsxcv RefCell: document panics in Clone, PartialEq, PartialOrd, Ord. This fixes rust-lang#47400 by adding: ```rust /// # Panics /// /// Panics if the value is currently mutably borrowed. ``` to said impls. They may panic since they call `.borrow()`.
This fixes #47400 by adding:
to said impls. They may panic since they call
.borrow()
.