@@ -290,8 +290,8 @@ where
290290///
291291/// However, the pointer might not actually point to allocated memory. In
292292/// particular, if you construct a `Vec` with capacity 0 via [`Vec::new`],
293- /// [`try_vec![]`], [`Vec::try_with_capacity(0)`] , or by calling
294- /// [`try_shrink_to_fit`] on an empty Vec, it will not allocate memory.
293+ /// [`try_vec![]`], [`Vec::try_with_capacity`] with an argument of 0 , or by
294+ /// calling [`try_shrink_to_fit`] on an empty Vec, it will not allocate memory.
295295/// Similarly, if you store zero-sized types inside a `Vec`, it will not
296296/// allocate space for them. *Note that in this case the `Vec` might not report
297297/// a [`capacity`] of 0*. `Vec` will allocate if and only if
@@ -303,7 +303,6 @@ where
303303/// it.
304304///
305305/// [`try_vec![]`]: try_vec!
306- /// [`Vec::try_with_capacity(0)`]: Vec::try_with_capacity
307306///
308307/// If a `Vec` *has* allocated memory, then the memory it points to is on the heap
309308/// (as defined by the allocator Rust is configured to use by default), and its
@@ -335,26 +334,26 @@ where
335334/// `Vec` will never perform a "small optimization" where elements are actually
336335/// stored on the stack for two reasons:
337336///
338- /// * It would make it more difficult for unsafe code to correctly manipulate
339- /// a `Vec`. The contents of a `Vec` wouldn't have a stable address if it were
337+ /// * It would make it more difficult for unsafe code to correctly manipulate a
338+ /// `Vec`. The contents of a `Vec` wouldn't have a stable address if it were
340339/// only moved, and it would be more difficult to determine if a `Vec` had
341340/// actually allocated memory.
342341///
343- /// * It would penalize the general case, incurring an additional branch
344- /// on every access.
342+ /// * It would penalize the general case, incurring an additional branch on
343+ /// every access.
345344///
346345/// `Vec` will never automatically shrink itself, even if completely empty. This
347346/// ensures no unnecessary allocations or deallocations occur. Emptying a `Vec`
348347/// and then filling it back up to the same [`len`] should incur no calls to the
349348/// allocator. If you wish to free up unused memory, use [`try_shrink_to_fit`]
350349/// or [`try_shrink_to`].
351350///
352- /// [`try_push`] and [`try_insert`] will never (re)allocate if the reported capacity is
353- /// sufficient. [`try_push`] and [`try_insert`] *will* (re)allocate if
354- /// <code>[len] == [capacity]</code>. That is, the reported capacity is completely
355- /// accurate, and can be relied on. It can even be used to manually free the memory
356- /// allocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even
357- /// when not necessary.
351+ /// [`try_push`] and [`try_insert`] will never (re)allocate if the reported
352+ /// capacity is sufficient. [`try_push`] and [`try_insert`] *will* (re)allocate
353+ /// if <code>[len] == [capacity]</code>. That is, the reported capacity is
354+ /// completely accurate, and can be relied on. It can even be used to manually
355+ /// free the memory allocated by a `Vec` if desired. Bulk insertion methods
356+ /// *may* reallocate, even when not necessary.
358357///
359358/// `Vec` does not guarantee any particular growth strategy when reallocating
360359/// when full, nor when [`try_reserve`] is called. The current strategy is basic
@@ -369,16 +368,16 @@ where
369368///
370369/// [`Vec::try_with_capacity(n)`]: Vec::try_with_capacity
371370///
372- /// `Vec` will not specifically overwrite any data that is removed from it,
373- /// but also won't specifically preserve it. Its uninitialized memory is
374- /// scratch space that it may use however it wants. It will generally just do
375- /// whatever is most efficient or otherwise easy to implement. Do not rely on
376- /// removed data to be erased for security purposes. Even if you drop a `Vec`, its
377- /// buffer may simply be reused by another allocation. Even if you zero a `Vec`'s memory
378- /// first, that might not actually happen because the optimizer does not consider
379- /// this a side-effect that must be preserved. There is one case which we will
380- /// not break, however: using `unsafe` code to write to the excess capacity,
381- /// and then increasing the length to match, is always valid.
371+ /// `Vec` will not specifically overwrite any data that is removed from it, but
372+ /// also won't specifically preserve it. Its uninitialized memory is scratch
373+ /// space that it may use however it wants. It will generally just do whatever
374+ /// is most efficient or otherwise easy to implement. Do not rely on removed
375+ /// data to be erased for security purposes. Even if you drop a `Vec`, its
376+ /// buffer may simply be reused by another allocation. Even if you zero a
377+ /// `Vec`'s memory first, that might not actually happen because the optimizer
378+ /// does not consider this a side-effect that must be preserved. There is one
379+ /// case which we will not break, however: using `unsafe` code to write to the
380+ /// excess capacity, and then increasing the length to match, is always valid.
382381///
383382/// Currently, `Vec` does not guarantee the order in which elements are dropped.
384383/// The order has changed in the past and may change again.
0 commit comments