@@ -47,10 +47,17 @@ const MAXIMUM_ZST_CAPACITY: usize = 1 << (64 - 1); // Largest possible power of
4747/// push onto the back in this manner, and iterating over `VecDeque` goes front
4848/// to back.
4949///
50+ /// Since `VecDeque` is a ring buffer, its elements are not necessarily contiguous
51+ /// in memory. If you want to access the elements as a single slice, such as for
52+ /// efficient sorting, you can use [`make_contiguous`]. It rotates the `VecDeque`
53+ /// so that its elements do not wrap, and returns a mutable slice to the
54+ /// now-contiguous element sequence.
55+ ///
5056/// [`push_back`]: #method.push_back
5157/// [`pop_front`]: #method.pop_front
5258/// [`extend`]: #method.extend
5359/// [`append`]: #method.append
60+ /// [`make_contiguous`]: #method.make_contiguous
5461#[ cfg_attr( not( test) , rustc_diagnostic_item = "vecdeque_type" ) ]
5562#[ stable( feature = "rust1" , since = "1.0.0" ) ]
5663pub struct VecDeque < T > {
@@ -2188,8 +2195,6 @@ impl<T> VecDeque<T> {
21882195 /// Sorting the content of a deque.
21892196 ///
21902197 /// ```
2191- /// #![feature(deque_make_contiguous)]
2192- ///
21932198 /// use std::collections::VecDeque;
21942199 ///
21952200 /// let mut buf = VecDeque::with_capacity(15);
@@ -2210,8 +2215,6 @@ impl<T> VecDeque<T> {
22102215 /// Getting immutable access to the contiguous slice.
22112216 ///
22122217 /// ```rust
2213- /// #![feature(deque_make_contiguous)]
2214- ///
22152218 /// use std::collections::VecDeque;
22162219 ///
22172220 /// let mut buf = VecDeque::new();
@@ -2228,7 +2231,7 @@ impl<T> VecDeque<T> {
22282231 /// assert_eq!(slice, &[3, 2, 1] as &[_]);
22292232 /// }
22302233 /// ```
2231- #[ unstable ( feature = "deque_make_contiguous" , issue = "70929 " ) ]
2234+ #[ stable ( feature = "deque_make_contiguous" , since = "1.48.0 " ) ]
22322235 pub fn make_contiguous ( & mut self ) -> & mut [ T ] {
22332236 if self . is_contiguous ( ) {
22342237 let tail = self . tail ;
0 commit comments