Skip to content

Commit

Permalink
Rollup merge of rust-lang#87174 - inquisitivecrystal:array-map, r=ken…
Browse files Browse the repository at this point in the history
…nytm

Stabilize `[T; N]::map()`

This stabilizes the `[T; N]::map()` function, gated by the `array_map` feature. The FCP has [already completed.](rust-lang#75243 (comment))

Closes rust-lang#75243.
  • Loading branch information
GuillaumeGomez authored Jul 16, 2021
2 parents ecbb863 + 7fc4fc7 commit d6d0632
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 2 additions & 3 deletions library/core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ impl<T, const N: usize> [T; N] {
/// # Examples
///
/// ```
/// #![feature(array_map)]
/// let x = [1, 2, 3];
/// let y = x.map(|v| v + 1);
/// assert_eq!(y, [2, 3, 4]);
Expand All @@ -310,7 +309,7 @@ impl<T, const N: usize> [T; N] {
/// let y = x.map(|v| v.len());
/// assert_eq!(y, [6, 9, 3, 3]);
/// ```
#[unstable(feature = "array_map", issue = "75243")]
#[stable(feature = "array_map", since = "1.55.0")]
pub fn map<F, U>(self, f: F) -> [U; N]
where
F: FnMut(T) -> U,
Expand Down Expand Up @@ -377,7 +376,7 @@ impl<T, const N: usize> [T; N] {
/// array if its elements are not `Copy`.
///
/// ```
/// #![feature(array_methods, array_map)]
/// #![feature(array_methods)]
///
/// let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
/// let is_ascii = strings.each_ref().map(|s| s.is_ascii());
Expand Down
1 change: 0 additions & 1 deletion library/core/tests/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![feature(alloc_layout_extra)]
#![feature(array_chunks)]
#![feature(array_methods)]
#![feature(array_map)]
#![feature(array_windows)]
#![feature(bool_to_option)]
#![feature(box_syntax)]
Expand Down

0 comments on commit d6d0632

Please sign in to comment.