Skip to content

Commit

Permalink
Auto merge of #64877 - lzutao:stabilize-repeat_generic_slice, r=Simon…
Browse files Browse the repository at this point in the history
…Sapin

Stabilize `slice::repeat` (feature `repeat_generic_slice`)

Closes #48784
r? @SimonSapin
  • Loading branch information
bors committed Oct 11, 2019
2 parents d4f7f97 + 4a2ae45 commit 6767d9b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
6 changes: 1 addition & 5 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,20 +411,16 @@ impl<T> [T] {
/// Basic usage:
///
/// ```
/// #![feature(repeat_generic_slice)]
/// assert_eq!([1, 2].repeat(3), vec![1, 2, 1, 2, 1, 2]);
/// ```
///
/// A panic upon overflow:
///
/// ```should_panic
/// #![feature(repeat_generic_slice)]
/// // this will panic at runtime
/// b"0123456789abcdef".repeat(usize::max_value());
/// ```
#[unstable(feature = "repeat_generic_slice",
reason = "it's on str, why not on slice?",
issue = "48784")]
#[stable(feature = "repeat_generic_slice", since = "1.40.0")]
pub fn repeat(&self, n: usize) -> Vec<T> where T: Copy {
if n == 0 {
return Vec::new();
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![feature(exact_size_is_empty)]
#![feature(option_flattening)]
#![feature(pattern)]
#![feature(repeat_generic_slice)]
#![feature(trusted_len)]
#![feature(try_reserve)]
#![feature(unboxed_closures)]
Expand Down

0 comments on commit 6767d9b

Please sign in to comment.