about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-01-07 20:43:20 +0100
committerGitHub <noreply@github.com>2023-01-07 20:43:20 +0100
commitd7519c363994d87a05efb2041bb2bbbdda55e9ef (patch)
tree28b79b920c1c103a358f75fb8eb16e94c196c8e3
parent771cfa5581fd245b0d45e839e791b10e01ebb8a7 (diff)
parentac583f18b75f005023b41d49298d4d343740648a (diff)
downloadrust-d7519c363994d87a05efb2041bb2bbbdda55e9ef.tar.gz
rust-d7519c363994d87a05efb2041bb2bbbdda55e9ef.zip
Rollup merge of #105128 - Sp00ph:vec_vec_deque_conversion, r=dtolnay
Add O(1) `Vec -> VecDeque` conversion guarantee

(See #105072)
-rw-r--r--library/alloc/src/collections/vec_deque/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs
index c955db46d29..0017baa66ab 100644
--- a/library/alloc/src/collections/vec_deque/mod.rs
+++ b/library/alloc/src/collections/vec_deque/mod.rs
@@ -2821,9 +2821,9 @@ impl<T, A: Allocator> From<Vec<T, A>> for VecDeque<T, A> {
     /// [`Vec<T>`]: crate::vec::Vec
     /// [`VecDeque<T>`]: crate::collections::VecDeque
     ///
-    /// In its current implementation, this is a very cheap
-    /// conversion. This isn't yet a guarantee though, and
-    /// shouldn't be relied on.
+    /// This conversion is guaranteed to run in *O*(1) time
+    /// and to not re-allocate the `Vec`'s buffer or allocate
+    /// any additional memory.
     #[inline]
     fn from(other: Vec<T, A>) -> Self {
         let (ptr, len, cap, alloc) = other.into_raw_parts_with_alloc();