Skip to content

Commit d7519c3

Browse files
authored
Rollup merge of rust-lang#105128 - Sp00ph:vec_vec_deque_conversion, r=dtolnay
Add O(1) `Vec -> VecDeque` conversion guarantee (See rust-lang#105072)
2 parents 771cfa5 + ac583f1 commit d7519c3

File tree

1 file changed

+3
-3
lines changed
  • library/alloc/src/collections/vec_deque

1 file changed

+3
-3
lines changed

library/alloc/src/collections/vec_deque/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2821,9 +2821,9 @@ impl<T, A: Allocator> From<Vec<T, A>> for VecDeque<T, A> {
28212821
/// [`Vec<T>`]: crate::vec::Vec
28222822
/// [`VecDeque<T>`]: crate::collections::VecDeque
28232823
///
2824-
/// In its current implementation, this is a very cheap
2825-
/// conversion. This isn't yet a guarantee though, and
2826-
/// shouldn't be relied on.
2824+
/// This conversion is guaranteed to run in *O*(1) time
2825+
/// and to not re-allocate the `Vec`'s buffer or allocate
2826+
/// any additional memory.
28272827
#[inline]
28282828
fn from(other: Vec<T, A>) -> Self {
28292829
let (ptr, len, cap, alloc) = other.into_raw_parts_with_alloc();

0 commit comments

Comments
 (0)