1
Fork 0

fix ptr inconsistency in Rc Arc

This commit is contained in:
LemonJ 2025-03-10 16:39:38 +08:00
parent c8a5072028
commit 55c658b242
2 changed files with 47 additions and 23 deletions

View file

@ -1327,10 +1327,13 @@ impl<T: ?Sized> Rc<T> {
/// ///
/// # Safety /// # Safety
/// ///
/// The pointer must have been obtained through `Rc::into_raw`, the /// The pointer must have been obtained through `Rc::into_raw` and must satisfy the
/// associated `Rc` instance must be valid (i.e. the strong count must be at /// same layout requirements specified in [`Rc::from_raw_in`][from_raw_in].
/// The associated `Rc` instance must be valid (i.e. the strong count must be at
/// least 1) for the duration of this method, and `ptr` must point to a block of memory /// least 1) for the duration of this method, and `ptr` must point to a block of memory
/// allocated by the global allocator. /// allocated by `alloc`.
///
/// [from_raw_in]: Rc::from_raw_in
/// ///
/// # Examples /// # Examples
/// ///
@ -1360,12 +1363,15 @@ impl<T: ?Sized> Rc<T> {
/// ///
/// # Safety /// # Safety
/// ///
/// The pointer must have been obtained through `Rc::into_raw`, the /// The pointer must have been obtained through `Rc::into_raw`and must satisfy the
/// associated `Rc` instance must be valid (i.e. the strong count must be at /// same layout requirements specified in [`Rc::from_raw_in`][from_raw_in].
/// The associated `Rc` instance must be valid (i.e. the strong count must be at
/// least 1) when invoking this method, and `ptr` must point to a block of memory /// 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 `Rc` and /// allocated by the global allocator. This method can be used to release the final `Rc` and
/// backing storage, but **should not** be called after the final `Rc` has been released. /// backing storage, but **should not** be called after the final `Rc` has been released.
/// ///
/// [from_raw_in]: Rc::from_raw_in
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@ -1623,10 +1629,13 @@ impl<T: ?Sized, A: Allocator> Rc<T, A> {
/// ///
/// # Safety /// # Safety
/// ///
/// The pointer must have been obtained through `Rc::into_raw`, the /// The pointer must have been obtained through `Rc::into_raw` and must satisfy the
/// associated `Rc` instance must be valid (i.e. the strong count must be at /// same layout requirements specified in [`Rc::from_raw_in`][from_raw_in].
/// The associated `Rc` instance must be valid (i.e. the strong count must be at
/// least 1) for the duration of this method, and `ptr` must point to a block of memory /// least 1) for the duration of this method, and `ptr` must point to a block of memory
/// allocated by `alloc` /// allocated by `alloc`.
///
/// [from_raw_in]: Rc::from_raw_in
/// ///
/// # Examples /// # Examples
/// ///
@ -1665,11 +1674,14 @@ impl<T: ?Sized, A: Allocator> Rc<T, A> {
/// ///
/// # Safety /// # Safety
/// ///
/// The pointer must have been obtained through `Rc::into_raw`, the /// The pointer must have been obtained through `Rc::into_raw`and must satisfy the
/// associated `Rc` instance must be valid (i.e. the strong count must be at /// same layout requirements specified in [`Rc::from_raw_in`][from_raw_in].
/// The associated `Rc` instance must be valid (i.e. the strong count must be at
/// least 1) when invoking this method, and `ptr` must point to a block of memory /// least 1) when invoking this method, and `ptr` must point to a block of memory
/// allocated by `alloc`. This method can be used to release the final `Rc` and backing storage, /// allocated by the global allocator. This method can be used to release the final `Rc` and
/// but **should not** be called after the final `Rc` has been released. /// backing storage, but **should not** be called after the final `Rc` has been released.
///
/// [from_raw_in]: Rc::from_raw_in
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -1453,11 +1453,14 @@ impl<T: ?Sized> Arc<T> {
/// ///
/// # Safety /// # Safety
/// ///
/// The pointer must have been obtained through `Arc::into_raw`, and the /// The pointer must have been obtained through `Arc::into_raw` and must satisfy the
/// associated `Arc` instance must be valid (i.e. the strong count must be at /// same layout requirements specified in [`Arc::from_raw_in`][from_raw_in].
/// The associated `Arc` instance must be valid (i.e. the strong count must be at
/// least 1) for the duration of this method, and `ptr` must point to a block of memory /// least 1) for the duration of this method, and `ptr` must point to a block of memory
/// allocated by the global allocator. /// allocated by the global allocator.
/// ///
/// [from_raw_in]: Arc::from_raw_in
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@ -1488,13 +1491,16 @@ impl<T: ?Sized> Arc<T> {
/// ///
/// # Safety /// # Safety
/// ///
/// The pointer must have been obtained through `Arc::into_raw`, and the /// The pointer must have been obtained through `Arc::into_raw` and must satisfy the
/// associated `Arc` instance must be valid (i.e. the strong count must be at /// same layout requirements specified in [`Arc::from_raw_in`][from_raw_in].
/// The associated `Arc` instance must be valid (i.e. the strong count must be at
/// least 1) when invoking this method, and `ptr` must point to a block of memory /// 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 /// 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 /// `Arc` and backing storage, but **should not** be called after the final `Arc` has been
/// released. /// released.
/// ///
/// [from_raw_in]: Arc::from_raw_in
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@ -1806,10 +1812,13 @@ impl<T: ?Sized, A: Allocator> Arc<T, A> {
/// ///
/// # Safety /// # Safety
/// ///
/// The pointer must have been obtained through `Arc::into_raw`, and the /// The pointer must have been obtained through `Arc::into_raw` and must satisfy the
/// associated `Arc` instance must be valid (i.e. the strong count must be at /// same layout requirements specified in [`Arc::from_raw_in`][from_raw_in].
/// least 1) for the duration of this method,, and `ptr` must point to a block of memory /// The associated `Arc` instance must be valid (i.e. the strong count must be at
/// allocated by `alloc`. /// least 1) for the duration of this method, and `ptr` must point to a block of memory
/// allocated by the global allocator.
///
/// [from_raw_in]: Arc::from_raw_in
/// ///
/// # Examples /// # Examples
/// ///
@ -1850,13 +1859,16 @@ impl<T: ?Sized, A: Allocator> Arc<T, A> {
/// ///
/// # Safety /// # Safety
/// ///
/// The pointer must have been obtained through `Arc::into_raw`, the /// The pointer must have been obtained through `Arc::into_raw` and must satisfy the
/// associated `Arc` instance must be valid (i.e. the strong count must be at /// same layout requirements specified in [`Arc::from_raw_in`][from_raw_in].
/// The associated `Arc` instance must be valid (i.e. the strong count must be at
/// least 1) when invoking this method, and `ptr` must point to a block of memory /// least 1) when invoking this method, and `ptr` must point to a block of memory
/// allocated by `alloc`. This method can be used to release the final /// 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 /// `Arc` and backing storage, but **should not** be called after the final `Arc` has been
/// released. /// released.
/// ///
/// [from_raw_in]: Arc::from_raw_in
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```