Clarify and restrict when {Arc,Rc}::get_mut_unchecked
is allowed.
This commit is contained in:
parent
fd3bfb3551
commit
96650fc714
@ -1091,10 +1091,11 @@ pub fn get_mut(this: &mut Self) -> Option<&mut T> {
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Any other `Rc` or [`Weak`] pointers to the same allocation must not be dereferenced
|
||||
/// for the duration of the returned borrow.
|
||||
/// This is trivially the case if no such pointers exist,
|
||||
/// for example immediately after `Rc::new`.
|
||||
/// If any other `Rc` or [`Weak`] pointers to the same allocation exist, then
|
||||
/// they must be must not be dereferenced or have active borrows for the duration
|
||||
/// of the returned borrow, and their inner type must be exactly the same as the
|
||||
/// inner type of this Rc (including lifetimes). This is trivially the case if no
|
||||
/// such pointers exist, for example immediately after `Rc::new`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -1630,10 +1630,11 @@ pub fn get_mut(this: &mut Self) -> Option<&mut T> {
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Any other `Arc` or [`Weak`] pointers to the same allocation must not be dereferenced
|
||||
/// for the duration of the returned borrow.
|
||||
/// This is trivially the case if no such pointers exist,
|
||||
/// for example immediately after `Arc::new`.
|
||||
/// If any other `Arc` or [`Weak`] pointers to the same allocation exist, then
|
||||
/// they must be must not be dereferenced or have active borrows for the duration
|
||||
/// of the returned borrow, and their inner type must be exactly the same as the
|
||||
/// inner type of this Rc (including lifetimes). This is trivially the case if no
|
||||
/// such pointers exist, for example immediately after `Arc::new`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user