@@ -592,21 +592,13 @@ impl<T> Vec<T> {
592592 ///
593593 /// # Examples
594594 ///
595- // FIXME Update this when vec_into_raw_parts is stabilized
596595 /// ```
597596 /// use std::ptr;
598- /// use std::mem;
599597 ///
600598 /// let v = vec![1, 2, 3];
601599 ///
602- /// // Prevent running `v`'s destructor so we are in complete control
603- /// // of the allocation.
604- /// let mut v = mem::ManuallyDrop::new(v);
605- ///
606- /// // Pull out the various important pieces of information about `v`
607- /// let p = v.as_mut_ptr();
608- /// let len = v.len();
609- /// let cap = v.capacity();
600+ /// // Deconstruct the vector into parts.
601+ /// let (p, len, cap) = v.into_raw_parts();
610602 ///
611603 /// unsafe {
612604 /// // Overwrite memory with 4, 5, 6
@@ -700,23 +692,13 @@ impl<T> Vec<T> {
700692 ///
701693 /// # Examples
702694 ///
703- // FIXME Update this when vec_into_raw_parts is stabilized
704695 /// ```
705696 /// #![feature(box_vec_non_null)]
706697 ///
707- /// use std::ptr::NonNull;
708- /// use std::mem;
709- ///
710698 /// let v = vec![1, 2, 3];
711699 ///
712- /// // Prevent running `v`'s destructor so we are in complete control
713- /// // of the allocation.
714- /// let mut v = mem::ManuallyDrop::new(v);
715- ///
716- /// // Pull out the various important pieces of information about `v`
717- /// let p = unsafe { NonNull::new_unchecked(v.as_mut_ptr()) };
718- /// let len = v.len();
719- /// let cap = v.capacity();
700+ /// // Deconstruct the vector into parts.
701+ /// let (p, len, cap) = v.into_parts();
720702 ///
721703 /// unsafe {
722704 /// // Overwrite memory with 4, 5, 6
@@ -783,7 +765,6 @@ impl<T> Vec<T> {
783765 /// # Examples
784766 ///
785767 /// ```
786- /// #![feature(vec_into_raw_parts)]
787768 /// let v: Vec<i32> = vec![-1, 0, 1];
788769 ///
789770 /// let (ptr, len, cap) = v.into_raw_parts();
@@ -798,7 +779,7 @@ impl<T> Vec<T> {
798779 /// assert_eq!(rebuilt, [4294967295, 0, 1]);
799780 /// ```
800781 #[ must_use = "losing the pointer will leak memory" ]
801- #[ unstable ( feature = "vec_into_raw_parts" , reason = "new API" , issue = "65816 ") ]
782+ #[ stable ( feature = "vec_into_raw_parts" , since = "CURRENT_RUSTC_VERSION " ) ]
802783 pub fn into_raw_parts ( self ) -> ( * mut T , usize , usize ) {
803784 let mut me = ManuallyDrop :: new ( self ) ;
804785 ( me. as_mut_ptr ( ) , me. len ( ) , me. capacity ( ) )
@@ -823,7 +804,7 @@ impl<T> Vec<T> {
823804 /// # Examples
824805 ///
825806 /// ```
826- /// #![feature(vec_into_raw_parts, box_vec_non_null)]
807+ /// #![feature(box_vec_non_null)]
827808 ///
828809 /// let v: Vec<i32> = vec![-1, 0, 1];
829810 ///
@@ -840,7 +821,6 @@ impl<T> Vec<T> {
840821 /// ```
841822 #[ must_use = "losing the pointer will leak memory" ]
842823 #[ unstable( feature = "box_vec_non_null" , reason = "new API" , issue = "130364" ) ]
843- // #[unstable(feature = "vec_into_raw_parts", reason = "new API", issue = "65816")]
844824 pub fn into_parts ( self ) -> ( NonNull < T > , usize , usize ) {
845825 let ( ptr, len, capacity) = self . into_raw_parts ( ) ;
846826 // SAFETY: A `Vec` always has a non-null pointer.
@@ -996,29 +976,20 @@ impl<T, A: Allocator> Vec<T, A> {
996976 ///
997977 /// # Examples
998978 ///
999- // FIXME Update this when vec_into_raw_parts is stabilized
1000979 /// ```
1001980 /// #![feature(allocator_api)]
1002981 ///
1003982 /// use std::alloc::System;
1004983 ///
1005984 /// use std::ptr;
1006- /// use std::mem;
1007985 ///
1008986 /// let mut v = Vec::with_capacity_in(3, System);
1009987 /// v.push(1);
1010988 /// v.push(2);
1011989 /// v.push(3);
1012990 ///
1013- /// // Prevent running `v`'s destructor so we are in complete control
1014- /// // of the allocation.
1015- /// let mut v = mem::ManuallyDrop::new(v);
1016- ///
1017- /// // Pull out the various important pieces of information about `v`
1018- /// let p = v.as_mut_ptr();
1019- /// let len = v.len();
1020- /// let cap = v.capacity();
1021- /// let alloc = v.allocator();
991+ /// // Deconstruct the vector into parts.
992+ /// let (p, len, cap, alloc) = v.into_raw_parts_with_alloc();
1022993 ///
1023994 /// unsafe {
1024995 /// // Overwrite memory with 4, 5, 6
@@ -1116,29 +1087,18 @@ impl<T, A: Allocator> Vec<T, A> {
11161087 ///
11171088 /// # Examples
11181089 ///
1119- // FIXME Update this when vec_into_raw_parts is stabilized
11201090 /// ```
11211091 /// #![feature(allocator_api, box_vec_non_null)]
11221092 ///
11231093 /// use std::alloc::System;
11241094 ///
1125- /// use std::ptr::NonNull;
1126- /// use std::mem;
1127- ///
11281095 /// let mut v = Vec::with_capacity_in(3, System);
11291096 /// v.push(1);
11301097 /// v.push(2);
11311098 /// v.push(3);
11321099 ///
1133- /// // Prevent running `v`'s destructor so we are in complete control
1134- /// // of the allocation.
1135- /// let mut v = mem::ManuallyDrop::new(v);
1136- ///
1137- /// // Pull out the various important pieces of information about `v`
1138- /// let p = unsafe { NonNull::new_unchecked(v.as_mut_ptr()) };
1139- /// let len = v.len();
1140- /// let cap = v.capacity();
1141- /// let alloc = v.allocator();
1100+ /// // Deconstruct the vector into parts.
1101+ /// let (p, len, cap, alloc) = v.into_parts_with_alloc();
11421102 ///
11431103 /// unsafe {
11441104 /// // Overwrite memory with 4, 5, 6
@@ -1206,7 +1166,7 @@ impl<T, A: Allocator> Vec<T, A> {
12061166 /// # Examples
12071167 ///
12081168 /// ```
1209- /// #![feature(allocator_api, vec_into_raw_parts )]
1169+ /// #![feature(allocator_api)]
12101170 ///
12111171 /// use std::alloc::System;
12121172 ///
@@ -1228,7 +1188,6 @@ impl<T, A: Allocator> Vec<T, A> {
12281188 /// ```
12291189 #[ must_use = "losing the pointer will leak memory" ]
12301190 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1231- // #[unstable(feature = "vec_into_raw_parts", reason = "new API", issue = "65816")]
12321191 pub fn into_raw_parts_with_alloc ( self ) -> ( * mut T , usize , usize , A ) {
12331192 let mut me = ManuallyDrop :: new ( self ) ;
12341193 let len = me. len ( ) ;
@@ -1256,7 +1215,7 @@ impl<T, A: Allocator> Vec<T, A> {
12561215 /// # Examples
12571216 ///
12581217 /// ```
1259- /// #![feature(allocator_api, vec_into_raw_parts, box_vec_non_null)]
1218+ /// #![feature(allocator_api, box_vec_non_null)]
12601219 ///
12611220 /// use std::alloc::System;
12621221 ///
@@ -1279,7 +1238,6 @@ impl<T, A: Allocator> Vec<T, A> {
12791238 #[ must_use = "losing the pointer will leak memory" ]
12801239 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
12811240 // #[unstable(feature = "box_vec_non_null", reason = "new API", issue = "130364")]
1282- // #[unstable(feature = "vec_into_raw_parts", reason = "new API", issue = "65816")]
12831241 pub fn into_parts_with_alloc ( self ) -> ( NonNull < T > , usize , usize , A ) {
12841242 let ( ptr, len, capacity, alloc) = self . into_raw_parts_with_alloc ( ) ;
12851243 // SAFETY: A `Vec` always has a non-null pointer.
0 commit comments