diff options
| author | LemonJ <1632798336@qq.com> | 2024-12-19 13:54:37 +0800 |
|---|---|---|
| committer | LemonJ <1632798336@qq.com> | 2024-12-19 22:20:42 +0800 |
| commit | 878a79691caa5b02bb8a91f10866903a4af8b523 (patch) | |
| tree | d011a2e5a009276a37e22371aa1f3083ff26fdb3 /library/alloc/src/sync.rs | |
| parent | 604d6691d9ee5c88a05569dd3f707b20afd76e97 (diff) | |
| download | rust-878a79691caa5b02bb8a91f10866903a4af8b523.tar.gz rust-878a79691caa5b02bb8a91f10866903a4af8b523.zip | |
Add missing safety descriptions to Arc's 'from_raw','increment_strong_count','decrement_strong_count'
Diffstat (limited to 'library/alloc/src/sync.rs')
| -rw-r--r-- | library/alloc/src/sync.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index 6cf41a3fa4e..dd899c8a71d 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -1376,6 +1376,8 @@ impl<T: ?Sized> Arc<T> { /// different types. See [`mem::transmute`][transmute] for more information /// on what restrictions apply in this case. /// + /// The raw pointer must point to a block of memory allocated by the global allocator + /// /// The user of `from_raw` has to make sure a specific value of `T` is only /// dropped once. /// @@ -1431,7 +1433,8 @@ impl<T: ?Sized> Arc<T> { /// /// The pointer must have been obtained through `Arc::into_raw`, and the /// associated `Arc` instance must be valid (i.e. the strong count must be at - /// least 1) for the duration of this method. + /// least 1) for the duration of this method, and `ptr` must point to a block of memory + /// allocated by the global allocator. /// /// # Examples /// @@ -1465,7 +1468,8 @@ impl<T: ?Sized> Arc<T> { /// /// The pointer must have been obtained through `Arc::into_raw`, and the /// associated `Arc` instance must be valid (i.e. the strong count must be at - /// least 1) when invoking this method. This method can be used to release the final + /// least 1) when invoking this method, and `ptr` must point to a block of memory + /// allocated by the global allocator. This method can be used to release the final /// `Arc` and backing storage, but **should not** be called after the final `Arc` has been /// released. /// |
