mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 09:13:07 +03:00
Stabilize slice::repeat (feature repeat_generic_slice)
This commit is contained in:
@@ -411,20 +411,16 @@ pub fn into_vec(self: Box<Self>) -> Vec<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();
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user