Skip to content

Commit

Permalink
Add missing safety descriptions to Arc's 'from_raw','increment_strong…
Browse files Browse the repository at this point in the history
…_count','decrement_strong_count'
  • Loading branch information
DiuDiu777 committed Dec 19, 2024
1 parent 604d669 commit 878a796
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions library/alloc/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -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
///
Expand Down Expand Up @@ -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.
///
Expand Down

0 comments on commit 878a796

Please sign in to comment.