Skip to content

Commit 7850674

Browse files
Allow Arc::from_raw to be used with a pointer from Arc::as_ptr
See #106124
1 parent b38a6d3 commit 7850674

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

library/alloc/src/sync.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -886,11 +886,11 @@ impl<T: ?Sized> Arc<T> {
886886
/// Constructs an `Arc<T>` from a raw pointer.
887887
///
888888
/// The raw pointer must have been previously returned by a call to
889-
/// [`Arc<U>::into_raw`][into_raw] where `U` must have the same size and
890-
/// alignment as `T`. This is trivially true if `U` is `T`.
891-
/// Note that if `U` is not `T` but has the same size and alignment, this is
892-
/// basically like transmuting references of different types. See
893-
/// [`mem::transmute`][transmute] for more information on what
889+
/// [`Arc<U>::into_raw`][into_raw] or [`Arc::<U>::as_ptr`][as_ptr] where `U`
890+
/// must have the same size and alignment as `T`. This is trivially true
891+
/// if `U` is `T`. Note that if `U` is not `T` but has the same size and
892+
/// alignment, this is basically like transmuting references of different
893+
/// types. See [`mem::transmute`][transmute] for more information on what
894894
/// restrictions apply in this case.
895895
///
896896
/// The user of `from_raw` has to make sure a specific value of `T` is only
@@ -900,6 +900,7 @@ impl<T: ?Sized> Arc<T> {
900900
/// even if the returned `Arc<T>` is never accessed.
901901
///
902902
/// [into_raw]: Arc::into_raw
903+
/// [as_ptr]: Arc::as_ptr
903904
/// [transmute]: core::mem::transmute
904905
///
905906
/// # Examples

0 commit comments

Comments
 (0)