Skip to content

Commit

Permalink
Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
chansuke committed Feb 7, 2021
1 parent 747e8ff commit b2d873f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1790,13 +1790,11 @@ impl<T, A: Allocator> Vec<T, A> {
/// let mut v = Vec::with_capacity(10);
/// v.extend([1, 2, 3].iter().cloned());
/// let slice = v.clone().into_boxed_slice();
/// let static_ref = Box::leak(slice);
///
/// unsafe {
/// let p = v.as_mut_ptr();
/// let len = v.len();
/// let rebuilt = Vec::from_raw_parts(p, len, static_ref.len());
/// assert_eq!(rebuilt.capacity(), 3);
/// let p = slice.as_ptr();
/// let rebuilt = std::slice::from_raw_parts(p, slice.len());
/// assert_eq!(rebuilt.len(), 3);
/// }
/// ```
#[stable(feature = "vec_leak", since = "1.47.0")]
Expand Down

0 comments on commit b2d873f

Please sign in to comment.