]> git.lizzy.rs Git - rust.git/commitdiff
Convert `Into<Box<[T]>> for Vec<T>` into `From<Vec<T>> for Box<[T]>`
authorOliver Middleton <olliemail27@gmail.com>
Sat, 17 Jun 2017 15:56:05 +0000 (16:56 +0100)
committerOliver Middleton <olliemail27@gmail.com>
Sat, 17 Jun 2017 19:49:21 +0000 (20:49 +0100)
src/liballoc/vec.rs

index 8bb16febb0483cbb8465da8435a052060e59d88b..c9c7a27c614fa08ca42cda12e8d18a2e70208a3e 100644 (file)
@@ -2124,10 +2124,12 @@ fn from(s: Box<[T]>) -> 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()
     }
 }