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 authored and gitbot committed Mar 4, 2025
1 parent 550e025 commit 2eb0f65
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions alloc/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,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 @@ -1452,7 +1454,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 @@ -1486,7 +1489,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 2eb0f65

Please sign in to comment.