Skip to content

Commit

Permalink
Add safety comments about Rc::get_unchecked_mut.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachs18 committed Sep 1, 2022
1 parent 30f0d3b commit 3c50442
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ pub fn cast_rc<A: NoUninit, B: AnyBitPattern>(input: Rc<A>) -> Rc<B> {
///
/// On failure you get back an error along with the starting `Rc`.
///
/// Safety: You must not use `Rc::get_mut_unchecked` on any `Rc` to the same
/// allocation while any `Rc` to a type which is not `AnyBitPattern + NoUninit`
/// exists.
///
/// ## Failure
///
/// * The start and end content type of the `Rc` must have the exact same
Expand Down Expand Up @@ -357,6 +361,10 @@ pub fn cast_arc<A: NoUninit, B: AnyBitPattern>(input: Arc<A>) -> Arc<B> {
///
/// On failure you get back an error along with the starting `Arc`.
///
/// Safety: You must not use `Arc::get_mut_unchecked` on any `Arc` to the same
/// allocation while any `Arc` to a type which is not `AnyBitPattern + NoUninit`
/// exists.
///
/// ## Failure
///
/// * The start and end content type of the `Arc` must have the exact same
Expand Down Expand Up @@ -387,6 +395,10 @@ pub fn cast_slice_rc<A: NoUninit, B: AnyBitPattern>(input: Rc<[A]>) -> Rc<[B]> {
///
/// On failure you get back an error along with the starting `Rc<[T]>`.
///
/// Safety: You must not use `Rc::get_mut_unchecked` on any `Rc` to the same
/// allocation while any `Rc` to a type which is not `AnyBitPattern + NoUninit`
/// exists.
///
/// ## Failure
///
/// * The start and end content type of the `Rc<[T]>` must have the exact same
Expand Down Expand Up @@ -439,6 +451,10 @@ pub fn cast_slice_arc<A: NoUninit, B: AnyBitPattern>(
///
/// On failure you get back an error along with the starting `Arc<[T]>`.
///
/// Safety: You must not use `Arc::get_mut_unchecked` on any `Arc` to the same
/// allocation while any `Arc` to a type which is not `AnyBitPattern + NoUninit`
/// exists.
///
/// ## Failure
///
/// * The start and end content type of the `Arc<[T]>` must have the exact same
Expand Down

0 comments on commit 3c50442

Please sign in to comment.