X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=library%2Falloc%2Fsrc%2Fvec%2Fmod.rs;h=cc53df812bb5456bcd7fe232db8d9817ebe73d3f;hb=e8e7f6e05cf664fe748caf0198983f72248489b4;hp=2ee91f88d3c224a50dbe8c0c15d3421ad7ea554d;hpb=f9d4eb0ae3014d5f949c2e088536f8571a967a15;p=rust.git diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 2ee91f88d3c..cc53df812bb 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -1,8 +1,8 @@ //! A contiguous growable array type with heap-allocated contents, written //! `Vec`. //! -//! Vectors have `O(1)` indexing, amortized `O(1)` push (to the end) and -//! `O(1)` pop (from the end). +//! Vectors have *O*(1) indexing, amortized *O*(1) push (to the end) and +//! *O*(1) pop (from the end). //! //! Vectors ensure they never allocate more than `isize::MAX` bytes. //! @@ -396,6 +396,7 @@ /// [owned slice]: Box #[stable(feature = "rust1", since = "1.0.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "vec_type")] +#[rustc_insignificant_dtor] pub struct Vec { buf: RawVec, len: usize, @@ -1270,7 +1271,7 @@ pub unsafe fn set_len(&mut self, new_len: usize) { /// /// The removed element is replaced by the last element of the vector. /// - /// This does not preserve ordering, but is O(1). + /// This does not preserve ordering, but is *O*(1). /// /// # Panics /// @@ -2115,6 +2116,7 @@ impl Vec { /// in order to be able to clone the passed value. /// If you need more flexibility (or want to rely on [`Default`] instead of /// [`Clone`]), use [`Vec::resize_with`]. + /// If you only need to resize to a smaller size, use [`Vec::truncate`]. /// /// # Examples ///