From fed3d6e64614adbd7ab4c73b561e48bc2800c899 Mon Sep 17 00:00:00 2001 From: Tim Diekmann Date: Wed, 25 Mar 2020 19:12:06 +0100 Subject: [PATCH] Fix safety section of `RawVec::into_box` --- src/liballoc/raw_vec.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index cbafeae6417a..baa642580579 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -574,7 +574,8 @@ impl RawVec { /// /// # Safety /// - /// * `len` must be smaller than or equal to `self.capacity()` + /// `shrink_to_fit(len)` must be called immediately prior to calling this function. This + /// implies, that `len` must be smaller than or equal to `self.capacity()`. pub unsafe fn into_box(self, len: usize) -> Box<[MaybeUninit]> { debug_assert!( len <= self.capacity(),