stabilize array repeat

This commit is contained in:
Kivooeo
2025-08-15 16:42:21 +00:00
parent c018ae5389
commit 489940ee1d
3 changed files with 1 additions and 5 deletions

View File

@@ -41,8 +41,6 @@ pub use iter::IntoIter;
/// ///
/// Creating multiple copies of a `String`: /// Creating multiple copies of a `String`:
/// ```rust /// ```rust
/// #![feature(array_repeat)]
///
/// use std::array; /// use std::array;
/// ///
/// let string = "Hello there!".to_string(); /// let string = "Hello there!".to_string();
@@ -50,7 +48,7 @@ pub use iter::IntoIter;
/// assert_eq!(strings, ["Hello there!", "Hello there!"]); /// assert_eq!(strings, ["Hello there!", "Hello there!"]);
/// ``` /// ```
#[inline] #[inline]
#[unstable(feature = "array_repeat", issue = "126695")] #[stable(feature = "array_repeat", since = "CURRENT_RUSTC_VERSION")]
pub fn repeat<T: Clone, const N: usize>(val: T) -> [T; N] { pub fn repeat<T: Clone, const N: usize>(val: T) -> [T; N] {
from_trusted_iterator(repeat_n(val, N)) from_trusted_iterator(repeat_n(val, N))
} }

View File

@@ -1,7 +1,6 @@
//@ compile-flags: -Copt-level=3 //@ compile-flags: -Copt-level=3
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(array_repeat)]
use std::array::repeat; use std::array::repeat;

View File

@@ -4,7 +4,6 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![feature(iter_repeat_n)] #![feature(iter_repeat_n)]
#![feature(array_repeat)]
#[derive(Clone)] #[derive(Clone)]
pub struct NotCopy(u16); pub struct NotCopy(u16);