Skip to content

Commit 878a796

Browse files
committed
Add missing safety descriptions to Arc's 'from_raw','increment_strong_count','decrement_strong_count'
1 parent 604d669 commit 878a796

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

library/alloc/src/sync.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,8 @@ impl<T: ?Sized> Arc<T> {
13761376
/// different types. See [`mem::transmute`][transmute] for more information
13771377
/// on what restrictions apply in this case.
13781378
///
1379+
/// The raw pointer must point to a block of memory allocated by the global allocator
1380+
///
13791381
/// The user of `from_raw` has to make sure a specific value of `T` is only
13801382
/// dropped once.
13811383
///
@@ -1431,7 +1433,8 @@ impl<T: ?Sized> Arc<T> {
14311433
///
14321434
/// The pointer must have been obtained through `Arc::into_raw`, and the
14331435
/// associated `Arc` instance must be valid (i.e. the strong count must be at
1434-
/// least 1) for the duration of this method.
1436+
/// least 1) for the duration of this method, and `ptr` must point to a block of memory
1437+
/// allocated by the global allocator.
14351438
///
14361439
/// # Examples
14371440
///
@@ -1465,7 +1468,8 @@ impl<T: ?Sized> Arc<T> {
14651468
///
14661469
/// The pointer must have been obtained through `Arc::into_raw`, and the
14671470
/// associated `Arc` instance must be valid (i.e. the strong count must be at
1468-
/// least 1) when invoking this method. This method can be used to release the final
1471+
/// least 1) when invoking this method, and `ptr` must point to a block of memory
1472+
/// allocated by the global allocator. This method can be used to release the final
14691473
/// `Arc` and backing storage, but **should not** be called after the final `Arc` has been
14701474
/// released.
14711475
///

0 commit comments

Comments
 (0)