Skip to content

Commit

Permalink
docs: clarify explicitly freeing heap allocated memory
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalpharush committed Nov 4, 2023
1 parent f1b104f commit ac47cd1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,12 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
/// dealloc(p as *mut u8, Layout::new::<String>());
/// }
/// ```
///
/// Note: This is equivalent to the following:
/// ```
/// let x = Box::new(String::from("Hello"));
/// let p = Box::into_raw(x);
/// drop(Box::from_raw(ptr));
/// ```
/// [memory layout]: self#memory-layout
#[stable(feature = "box_raw", since = "1.4.0")]
#[inline]
Expand Down

0 comments on commit ac47cd1

Please sign in to comment.