]> git.lizzy.rs Git - rust.git/commitdiff
std: Deprecate Vec::from_raw_buf
authorAlex Crichton <alex@alexcrichton.com>
Thu, 11 Jun 2015 01:40:20 +0000 (18:40 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 17 Jun 2015 16:07:16 +0000 (09:07 -0700)
This function is more naturally expressed as slice::from_raw_buf plus a call to
to_vec.

src/libcollections/vec.rs

index 3d7c82c9a94a687e02b137fe3a2111db24dd9bab..6b1e4bb4f8e6f4953db8427a9dc2b04434ea6619 100644 (file)
@@ -278,6 +278,8 @@ pub unsafe fn from_raw_parts(ptr: *mut T, length: usize,
     #[inline]
     #[unstable(feature = "vec_from_raw_buf",
                reason = "may be better expressed via composition")]
+    #[deprecated(since = "1.2.0",
+                 reason = "use slice::from_raw_parts + .to_vec() instead")]
     pub unsafe fn from_raw_buf(ptr: *const T, elts: usize) -> Vec<T> {
         let mut dst = Vec::with_capacity(elts);
         dst.set_len(elts);