@@ -592,21 +592,14 @@ impl<T> Vec<T> {
592592 ///
593593 /// # Examples
594594 ///
595- // FIXME Update this when vec_into_raw_parts is stabilized
596595 /// ```
597596 /// use std::ptr;
598597 /// use std::mem;
599598 ///
600599 /// let v = vec![1, 2, 3];
601600 ///
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();
601+ /// // Deconstruct the vector into parts.
602+ /// let (p, len, cap) = v.into_raw_parts();
610603 ///
611604 /// unsafe {
612605 /// // Overwrite memory with 4, 5, 6
@@ -700,7 +693,6 @@ impl<T> Vec<T> {
700693 ///
701694 /// # Examples
702695 ///
703- // FIXME Update this when vec_into_raw_parts is stabilized
704696 /// ```
705697 /// #![feature(box_vec_non_null)]
706698 ///
@@ -709,14 +701,8 @@ impl<T> Vec<T> {
709701 ///
710702 /// let v = vec![1, 2, 3];
711703 ///
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();
704+ /// // Deconstruct the vector into parts.
705+ /// let (p, len, cap) = v.into_parts();
720706 ///
721707 /// unsafe {
722708 /// // Overwrite memory with 4, 5, 6
@@ -783,7 +769,6 @@ impl<T> Vec<T> {
783769 /// # Examples
784770 ///
785771 /// ```
786- /// #![feature(vec_into_raw_parts)]
787772 /// let v: Vec<i32> = vec![-1, 0, 1];
788773 ///
789774 /// let (ptr, len, cap) = v.into_raw_parts();
@@ -798,7 +783,7 @@ impl<T> Vec<T> {
798783 /// assert_eq!(rebuilt, [4294967295, 0, 1]);
799784 /// ```
800785 #[ must_use = "losing the pointer will leak memory" ]
801- #[ unstable ( feature = "vec_into_raw_parts" , reason = "new API" , issue = "65816 ") ]
786+ #[ stable ( feature = "vec_into_raw_parts" , since = "CURRENT_RUSTC_VERSION " ) ]
802787 pub fn into_raw_parts ( self ) -> ( * mut T , usize , usize ) {
803788 let mut me = ManuallyDrop :: new ( self ) ;
804789 ( me. as_mut_ptr ( ) , me. len ( ) , me. capacity ( ) )
@@ -823,7 +808,7 @@ impl<T> Vec<T> {
823808 /// # Examples
824809 ///
825810 /// ```
826- /// #![feature(vec_into_raw_parts, box_vec_non_null)]
811+ /// #![feature(box_vec_non_null)]
827812 ///
828813 /// let v: Vec<i32> = vec![-1, 0, 1];
829814 ///
@@ -840,7 +825,6 @@ impl<T> Vec<T> {
840825 /// ```
841826 #[ must_use = "losing the pointer will leak memory" ]
842827 #[ unstable( feature = "box_vec_non_null" , reason = "new API" , issue = "130364" ) ]
843- // #[unstable(feature = "vec_into_raw_parts", reason = "new API", issue = "65816")]
844828 pub fn into_parts ( self ) -> ( NonNull < T > , usize , usize ) {
845829 let ( ptr, len, capacity) = self . into_raw_parts ( ) ;
846830 // SAFETY: A `Vec` always has a non-null pointer.
@@ -996,7 +980,6 @@ impl<T, A: Allocator> Vec<T, A> {
996980 ///
997981 /// # Examples
998982 ///
999- // FIXME Update this when vec_into_raw_parts is stabilized
1000983 /// ```
1001984 /// #![feature(allocator_api)]
1002985 ///
@@ -1010,15 +993,8 @@ impl<T, A: Allocator> Vec<T, A> {
1010993 /// v.push(2);
1011994 /// v.push(3);
1012995 ///
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();
996+ /// // Deconstruct the vector into parts.
997+ /// let (p, len, cap, alloc) = v.into_raw_parts_with_alloc();
1022998 ///
1023999 /// unsafe {
10241000 /// // Overwrite memory with 4, 5, 6
@@ -1116,7 +1092,6 @@ impl<T, A: Allocator> Vec<T, A> {
11161092 ///
11171093 /// # Examples
11181094 ///
1119- // FIXME Update this when vec_into_raw_parts is stabilized
11201095 /// ```
11211096 /// #![feature(allocator_api, box_vec_non_null)]
11221097 ///
@@ -1130,15 +1105,8 @@ impl<T, A: Allocator> Vec<T, A> {
11301105 /// v.push(2);
11311106 /// v.push(3);
11321107 ///
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();
1108+ /// // Deconstruct the vector into parts.
1109+ /// let (p, len, cap, alloc) = v.into_parts_with_alloc();
11421110 ///
11431111 /// unsafe {
11441112 /// // Overwrite memory with 4, 5, 6
@@ -1206,7 +1174,7 @@ impl<T, A: Allocator> Vec<T, A> {
12061174 /// # Examples
12071175 ///
12081176 /// ```
1209- /// #![feature(allocator_api, vec_into_raw_parts )]
1177+ /// #![feature(allocator_api)]
12101178 ///
12111179 /// use std::alloc::System;
12121180 ///
@@ -1228,7 +1196,6 @@ impl<T, A: Allocator> Vec<T, A> {
12281196 /// ```
12291197 #[ must_use = "losing the pointer will leak memory" ]
12301198 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1231- // #[unstable(feature = "vec_into_raw_parts", reason = "new API", issue = "65816")]
12321199 pub fn into_raw_parts_with_alloc ( self ) -> ( * mut T , usize , usize , A ) {
12331200 let mut me = ManuallyDrop :: new ( self ) ;
12341201 let len = me. len ( ) ;
@@ -1256,7 +1223,7 @@ impl<T, A: Allocator> Vec<T, A> {
12561223 /// # Examples
12571224 ///
12581225 /// ```
1259- /// #![feature(allocator_api, vec_into_raw_parts, box_vec_non_null)]
1226+ /// #![feature(allocator_api, box_vec_non_null)]
12601227 ///
12611228 /// use std::alloc::System;
12621229 ///
@@ -1279,7 +1246,6 @@ impl<T, A: Allocator> Vec<T, A> {
12791246 #[ must_use = "losing the pointer will leak memory" ]
12801247 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
12811248 // #[unstable(feature = "box_vec_non_null", reason = "new API", issue = "130364")]
1282- // #[unstable(feature = "vec_into_raw_parts", reason = "new API", issue = "65816")]
12831249 pub fn into_parts_with_alloc ( self ) -> ( NonNull < T > , usize , usize , A ) {
12841250 let ( ptr, len, capacity, alloc) = self . into_raw_parts_with_alloc ( ) ;
12851251 // SAFETY: A `Vec` always has a non-null pointer.
0 commit comments