From 7a641f7c516ac666c72bf9edfbec8648aa0160c7 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Fri, 16 Aug 2019 17:45:44 +0200 Subject: [PATCH] Relax the safety condition for get_mut_unchecked --- src/liballoc/rc.rs | 6 ++++-- src/liballoc/sync.rs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index abb09684260d..1509afa48893 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -719,8 +719,10 @@ impl Rc { /// /// # Safety /// - /// There must be no other `Rc` or [`Weak`] pointers to the same value. - /// This is the case for example immediately after `Rc::new`. + /// Any other `Rc` or [`Weak`] pointers to the same value must not be dereferenced + /// for the duration of the returned borrow. + /// This is trivially the case if no such pointer exist, + /// for example immediately after `Rc::new`. /// /// # Examples /// diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index bb4d1499014c..078ddc27da9b 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -1104,8 +1104,10 @@ impl Arc { /// /// # Safety /// - /// There must be no other `Arc` or [`Weak`] pointers to the same value. - /// This is the case for example immediately after `Rc::new`. + /// Any other `Arc` or [`Weak`] pointers to the same value must not be dereferenced + /// for the duration of the returned borrow. + /// This is trivially the case if no such pointer exist, + /// for example immediately after `Arc::new`. /// /// # Examples ///