@@ -1295,10 +1295,8 @@ impl<T> Weak<T> {
12951295
12961296 /// Returns a raw pointer to the object `T` pointed to by this `Weak<T>`.
12971297 ///
1298- /// It is up to the caller to ensure that the object is still alive when accessing it through
1299- /// the pointer.
1300- ///
1301- /// The pointer may be [`null`] or be dangling in case the object has already been destroyed.
1298+ /// The pointer is valid only if there are some strong references. The pointer may be dangling
1299+ /// or even [`null`] otherwise.
13021300 ///
13031301 /// # Examples
13041302 ///
@@ -1379,14 +1377,18 @@ impl<T> Weak<T> {
13791377 /// This can be used to safely get a strong reference (by calling [`upgrade`]
13801378 /// later) or to deallocate the weak count by dropping the `Weak<T>`.
13811379 ///
1382- /// It takes ownership of one weak count. In case a [`null`] is passed, a dangling [`Weak`] is
1383- /// returned .
1380+ /// It takes ownership of one weak count (with the exception of pointers created by [`new`],
1381+ /// as these don't have any corresponding weak count) .
13841382 ///
13851383 /// # Safety
13861384 ///
1387- /// The pointer must represent one valid weak count. In other words, it must point to `T` which
1388- /// is or *was* managed by an [`Arc`] and the weak count of that [`Arc`] must not have reached
1389- /// 0. It is allowed for the strong count to be 0.
1385+ /// The pointer must have originated from the [`into_raw`] (or [`as_raw'], provided there was
1386+ /// a corresponding [`forget`] on the `Weak<T>`) and must still own its potential weak reference
1387+ /// count.
1388+ ///
1389+ /// It is allowed for the strong count to be 0 at the time of calling this, but the weak count
1390+ /// must be non-zero or the pointer must have originated from a dangling `Weak<T>` (one created
1391+ /// by [`new`]).
13901392 ///
13911393 /// # Examples
13921394 ///
@@ -1411,11 +1413,13 @@ impl<T> Weak<T> {
14111413 /// assert!(unsafe { Weak::from_raw(raw_2) }.upgrade().is_none());
14121414 /// ```
14131415 ///
1414- /// [`null`]: ../../std/ptr/fn.null.html
1416+ /// [`as_raw`]: struct.Weak.html#method.as_raw
1417+ /// [`new`]: struct.Weak.html#method.new
14151418 /// [`into_raw`]: struct.Weak.html#method.into_raw
14161419 /// [`upgrade`]: struct.Weak.html#method.upgrade
14171420 /// [`Weak`]: struct.Weak.html
14181421 /// [`Arc`]: struct.Arc.html
1422+ /// [`forget`]: ../../std/mem/fn.forget.html
14191423 #[ unstable( feature = "weak_into_raw" , issue = "60728" ) ]
14201424 pub unsafe fn from_raw ( ptr : * const T ) -> Self {
14211425 if ptr. is_null ( ) {
0 commit comments