Skip to content

Commit

Permalink
Rollup merge of rust-lang#42717 - ollie27:into_to_from2, r=sfackler
Browse files Browse the repository at this point in the history
Convert `Into<Box<[T]>> for Vec<T>` into `From<Vec<T>> for Box<[T]>`

As the `collections` crate has been merged into `alloc` in rust-lang#42648 this impl is now possible. This is the final part of rust-lang#42129 missing from rust-lang#42227.
  • Loading branch information
frewsxcv committed Jun 20, 2017
2 parents 4c43bc3 + 222a328 commit dbe16e0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2124,10 +2124,12 @@ impl<T> From<Box<[T]>> for Vec<T> {
}
}

#[stable(feature = "box_from_vec", since = "1.18.0")]
impl<T> Into<Box<[T]>> for Vec<T> {
fn into(self) -> Box<[T]> {
self.into_boxed_slice()
// note: test pulls in libstd, which causes errors here
#[cfg(not(test))]
#[stable(feature = "box_from_vec", since = "1.20.0")]
impl<T> From<Vec<T>> for Box<[T]> {
fn from(v: Vec<T>) -> Box<[T]> {
v.into_boxed_slice()
}
}

Expand Down

0 comments on commit dbe16e0

Please sign in to comment.