Skip to content

Commit 94723d4

Browse files
authored
Rollup merge of rust-lang#103522 - Dylan-DPC:76118/array-methods-stab, r=dtolnay
stabilise array methods Closes rust-lang#76118 Stabilises the remaining array methods FCP is yet to be carried out for this There wasn't a clear consensus on the naming, but all the other alternatives had some flaws as discussed in the tracking issue and there was a silence on this issue for a year
2 parents e7bbe8c + 2326f42 commit 94723d4

File tree

4 files changed

+2
-10
lines changed

4 files changed

+2
-10
lines changed

library/alloc/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
#![feature(allocator_api)]
104104
#![feature(array_chunks)]
105105
#![feature(array_into_iter_constructors)]
106-
#![feature(array_methods)]
107106
#![feature(array_windows)]
108107
#![feature(ascii_char)]
109108
#![feature(assert_matches)]

library/core/src/array/mod.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,6 @@ impl<T, const N: usize> [T; N] {
559559
/// # Example
560560
///
561561
/// ```
562-
/// #![feature(array_methods)]
563-
///
564562
/// let floats = [3.1, 2.7, -1.0];
565563
/// let float_refs: [&f64; 3] = floats.each_ref();
566564
/// assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);
@@ -571,16 +569,14 @@ impl<T, const N: usize> [T; N] {
571569
/// array if its elements are not [`Copy`].
572570
///
573571
/// ```
574-
/// #![feature(array_methods)]
575-
///
576572
/// let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()];
577573
/// let is_ascii = strings.each_ref().map(|s| s.is_ascii());
578574
/// assert_eq!(is_ascii, [true, false, true]);
579575
///
580576
/// // We can still access the original array: it has not been moved.
581577
/// assert_eq!(strings.len(), 3);
582578
/// ```
583-
#[unstable(feature = "array_methods", issue = "76118")]
579+
#[stable(feature = "array_methods", since = "CURRENT_RUSTC_VERSION")]
584580
pub fn each_ref(&self) -> [&T; N] {
585581
from_trusted_iterator(self.iter())
586582
}
@@ -592,15 +588,14 @@ impl<T, const N: usize> [T; N] {
592588
/// # Example
593589
///
594590
/// ```
595-
/// #![feature(array_methods)]
596591
///
597592
/// let mut floats = [3.1, 2.7, -1.0];
598593
/// let float_refs: [&mut f64; 3] = floats.each_mut();
599594
/// *float_refs[0] = 0.0;
600595
/// assert_eq!(float_refs, [&mut 0.0, &mut 2.7, &mut -1.0]);
601596
/// assert_eq!(floats, [0.0, 2.7, -1.0]);
602597
/// ```
603-
#[unstable(feature = "array_methods", issue = "76118")]
598+
#[stable(feature = "array_methods", since = "CURRENT_RUSTC_VERSION")]
604599
pub fn each_mut(&mut self) -> [&mut T; N] {
605600
from_trusted_iterator(self.iter_mut())
606601
}

library/core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![feature(alloc_layout_extra)]
22
#![feature(array_chunks)]
3-
#![feature(array_methods)]
43
#![feature(array_windows)]
54
#![feature(ascii_char)]
65
#![feature(ascii_char_variants)]

src/librustdoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
html_playground_url = "https://play.rust-lang.org/"
44
)]
55
#![feature(rustc_private)]
6-
#![feature(array_methods)]
76
#![feature(assert_matches)]
87
#![feature(box_patterns)]
98
#![feature(if_let_guard)]

0 commit comments

Comments
 (0)