about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-28 09:40:05 +0000
committerbors <bors@rust-lang.org>2018-07-28 09:40:05 +0000
commitcc224282de8de427005103e5c0504cbdf1148694 (patch)
tree9061d4e1ab49458fe2ab7c56c3e94ba8d650b6f9 /src/liballoc
parent05607476521732c5c71bc063c8be5056aa573b15 (diff)
parent59f8422a17c136582aeecf0c975deb6896df3595 (diff)
downloadrust-cc224282de8de427005103e5c0504cbdf1148694.tar.gz
rust-cc224282de8de427005103e5c0504cbdf1148694.zip
Auto merge of #52802 - kennytm:rollup, r=kennytm
Rollup of 11 pull requests

Successful merges:

 - #52702 (Suggest fix when encountering different mutability from impl to trait)
 - #52703 (Improve a few vectors - calculate capacity or build from iterators)
 - #52740 (Suggest underscore when using dashes in crate namet push fork)
 - #52759 (Impl Send & Sync for JoinHandle)
 - #52760 (rustc_metadata: test loading atoi instead of cos)
 - #52763 (Omit the vendor component in Fuchsia triple)
 - #52765 (Remove unused "-Zenable_nonzeroing_move_hints" flag)
 - #52769 (Incorporate a stray test)
 - #52777 (Fix doc comment for 'ptr::copy_to' method)
 - #52779 (revert accidental atty downgrade)
 - #52781 (Use a slice where a vector is not necessary)

Failed merges:

r? @ghost
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/repeat-generic-slice.rs19
-rw-r--r--src/liballoc/tests/lib.rs1
-rw-r--r--src/liballoc/tests/slice.rs11
3 files changed, 12 insertions, 19 deletions
diff --git a/src/liballoc/repeat-generic-slice.rs b/src/liballoc/repeat-generic-slice.rs
deleted file mode 100644
index 5c14ee4fd83..00000000000
--- a/src/liballoc/repeat-generic-slice.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(repeat_generic_slice)]
-
-fn main() {
-    assert_eq!([1, 2].repeat(2), vec![1, 2, 1, 2]);
-    assert_eq!([1, 2, 3, 4].repeat(0), vec![]);
-    assert_eq!([1, 2, 3, 4].repeat(1), vec![1, 2, 3, 4]);
-    assert_eq!([1, 2, 3, 4].repeat(3),
-               vec![1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]);
-}
diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs
index 91bc778ad4c..618aff963f2 100644
--- a/src/liballoc/tests/lib.rs
+++ b/src/liballoc/tests/lib.rs
@@ -24,6 +24,7 @@
 #![feature(try_reserve)]
 #![feature(unboxed_closures)]
 #![feature(exact_chunks)]
+#![feature(repeat_generic_slice)]
 
 extern crate alloc_system;
 extern crate core;
diff --git a/src/liballoc/tests/slice.rs b/src/liballoc/tests/slice.rs
index 3b7eec38609..df5e18a9a18 100644
--- a/src/liballoc/tests/slice.rs
+++ b/src/liballoc/tests/slice.rs
@@ -1529,3 +1529,14 @@ fn panic_safe() {
         }
     }
 }
+
+#[test]
+fn repeat_generic_slice() {
+    assert_eq!([1, 2].repeat(2), vec![1, 2, 1, 2]);
+    assert_eq!([1, 2, 3, 4].repeat(0), vec![]);
+    assert_eq!([1, 2, 3, 4].repeat(1), vec![1, 2, 3, 4]);
+    assert_eq!(
+        [1, 2, 3, 4].repeat(3),
+        vec![1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
+    );
+}