std: Deprecate Vec::from_raw_buf

This function is more naturally expressed as slice::from_raw_buf plus a call to
to_vec.
This commit is contained in:
Alex Crichton 2015-06-10 18:40:20 -07:00
parent f85c4f62d8
commit 68b628b165
1 changed files with 2 additions and 0 deletions

View File

@ -278,6 +278,8 @@ impl<T> Vec<T> {
#[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);