about summary refs log tree commit diff
path: root/src/liballoc/sync.rs
diff options
context:
space:
mode:
authorLukas Lueg <lukas.lueg@gmail.com>2020-01-10 19:39:01 +0100
committerLukas Lueg <lukas.lueg@gmail.com>2020-01-10 19:39:01 +0100
commitbecebf3106407b892f25807473e23d6e8f116a1e (patch)
tree66d6c47981ba7ee5f47189cde4ede1f3b129d665 /src/liballoc/sync.rs
parentf795e8a216b44982706d41e5cbfa245d13b83fc1 (diff)
downloadrust-becebf3106407b892f25807473e23d6e8f116a1e.tar.gz
rust-becebf3106407b892f25807473e23d6e8f116a1e.zip
Ammend Rc/Arc::from_raw() docs regarding unsafety
Constructing an Rc/Arc is unsafe even if the wrapped `T`
is never dereferenced.
Diffstat (limited to 'src/liballoc/sync.rs')
-rw-r--r--src/liballoc/sync.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs
index dc53ad28407..024f9407604 100644
--- a/src/liballoc/sync.rs
+++ b/src/liballoc/sync.rs
@@ -553,10 +553,11 @@ impl<T: ?Sized> Arc<T> {
     /// Constructs an `Arc` from a raw pointer.
     ///
     /// The raw pointer must have been previously returned by a call to a
-    /// [`Arc::into_raw`][into_raw].
+    /// [`Arc::into_raw`][into_raw], using the same `T`.
     ///
-    /// This function is unsafe because improper use may lead to memory problems. For example, a
-    /// double-free may occur if the function is called twice on the same raw pointer.
+    /// This function is unsafe because improper use may lead to memory unsafety,
+    /// even if `T` is never accessed. For example, a double-free may occur if the function is
+    /// called twice on the same raw pointer.
     ///
     /// [into_raw]: struct.Arc.html#method.into_raw
     ///