Skip to content

Commit 6a6c644

Browse files
authored
Rollup merge of #84328 - Folyd:stablize_map_into_keys_values, r=m-ou-se
Stablize {HashMap,BTreeMap}::into_{keys,values} I would propose to stabilize `{HashMap,BTreeMap}::into_{keys,values}`( aka. `map_into_keys_values`). Closes #75294.
2 parents 5dcdeb8 + b6f3dbb commit 6a6c644

File tree

2 files changed

+26
-34
lines changed
  • library
    • alloc/src/collections/btree
    • std/src/collections/hash

2 files changed

+26
-34
lines changed

Diff for: library/alloc/src/collections/btree/map.rs

+14-16
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,12 @@ impl<K, V: fmt::Debug> fmt::Debug for ValuesMut<'_, K, V> {
398398
/// See its documentation for more.
399399
///
400400
/// [`into_keys`]: BTreeMap::into_keys
401-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
401+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
402402
pub struct IntoKeys<K, V> {
403403
inner: IntoIter<K, V>,
404404
}
405405

406-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
406+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
407407
impl<K: fmt::Debug, V> fmt::Debug for IntoKeys<K, V> {
408408
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
409409
f.debug_list().entries(self.inner.iter().map(|(key, _)| key)).finish()
@@ -416,12 +416,12 @@ impl<K: fmt::Debug, V> fmt::Debug for IntoKeys<K, V> {
416416
/// See its documentation for more.
417417
///
418418
/// [`into_values`]: BTreeMap::into_values
419-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
419+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
420420
pub struct IntoValues<K, V> {
421421
inner: IntoIter<K, V>,
422422
}
423423

424-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
424+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
425425
impl<K, V: fmt::Debug> fmt::Debug for IntoValues<K, V> {
426426
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
427427
f.debug_list().entries(self.inner.iter().map(|(_, val)| val)).finish()
@@ -1242,7 +1242,6 @@ impl<K, V> BTreeMap<K, V> {
12421242
/// # Examples
12431243
///
12441244
/// ```
1245-
/// #![feature(map_into_keys_values)]
12461245
/// use std::collections::BTreeMap;
12471246
///
12481247
/// let mut a = BTreeMap::new();
@@ -1253,7 +1252,7 @@ impl<K, V> BTreeMap<K, V> {
12531252
/// assert_eq!(keys, [1, 2]);
12541253
/// ```
12551254
#[inline]
1256-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1255+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
12571256
pub fn into_keys(self) -> IntoKeys<K, V> {
12581257
IntoKeys { inner: self.into_iter() }
12591258
}
@@ -1265,7 +1264,6 @@ impl<K, V> BTreeMap<K, V> {
12651264
/// # Examples
12661265
///
12671266
/// ```
1268-
/// #![feature(map_into_keys_values)]
12691267
/// use std::collections::BTreeMap;
12701268
///
12711269
/// let mut a = BTreeMap::new();
@@ -1276,7 +1274,7 @@ impl<K, V> BTreeMap<K, V> {
12761274
/// assert_eq!(values, ["hello", "goodbye"]);
12771275
/// ```
12781276
#[inline]
1279-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1277+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
12801278
pub fn into_values(self) -> IntoValues<K, V> {
12811279
IntoValues { inner: self.into_iter() }
12821280
}
@@ -1776,7 +1774,7 @@ impl<'a, K, V> Range<'a, K, V> {
17761774
}
17771775
}
17781776

1779-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1777+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
17801778
impl<K, V> Iterator for IntoKeys<K, V> {
17811779
type Item = K;
17821780

@@ -1801,24 +1799,24 @@ impl<K, V> Iterator for IntoKeys<K, V> {
18011799
}
18021800
}
18031801

1804-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1802+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
18051803
impl<K, V> DoubleEndedIterator for IntoKeys<K, V> {
18061804
fn next_back(&mut self) -> Option<K> {
18071805
self.inner.next_back().map(|(k, _)| k)
18081806
}
18091807
}
18101808

1811-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1809+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
18121810
impl<K, V> ExactSizeIterator for IntoKeys<K, V> {
18131811
fn len(&self) -> usize {
18141812
self.inner.len()
18151813
}
18161814
}
18171815

1818-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1816+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
18191817
impl<K, V> FusedIterator for IntoKeys<K, V> {}
18201818

1821-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1819+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
18221820
impl<K, V> Iterator for IntoValues<K, V> {
18231821
type Item = V;
18241822

@@ -1835,21 +1833,21 @@ impl<K, V> Iterator for IntoValues<K, V> {
18351833
}
18361834
}
18371835

1838-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1836+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
18391837
impl<K, V> DoubleEndedIterator for IntoValues<K, V> {
18401838
fn next_back(&mut self) -> Option<V> {
18411839
self.inner.next_back().map(|(_, v)| v)
18421840
}
18431841
}
18441842

1845-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1843+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
18461844
impl<K, V> ExactSizeIterator for IntoValues<K, V> {
18471845
fn len(&self) -> usize {
18481846
self.inner.len()
18491847
}
18501848
}
18511849

1852-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1850+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
18531851
impl<K, V> FusedIterator for IntoValues<K, V> {}
18541852

18551853
#[stable(feature = "btree_range", since = "1.17.0")]

Diff for: library/std/src/collections/hash/map.rs

+12-18
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,6 @@ where
962962
/// # Examples
963963
///
964964
/// ```
965-
/// #![feature(map_into_keys_values)]
966965
/// use std::collections::HashMap;
967966
///
968967
/// let mut map = HashMap::new();
@@ -973,7 +972,7 @@ where
973972
/// let vec: Vec<&str> = map.into_keys().collect();
974973
/// ```
975974
#[inline]
976-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
975+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
977976
pub fn into_keys(self) -> IntoKeys<K, V> {
978977
IntoKeys { inner: self.into_iter() }
979978
}
@@ -985,7 +984,6 @@ where
985984
/// # Examples
986985
///
987986
/// ```
988-
/// #![feature(map_into_keys_values)]
989987
/// use std::collections::HashMap;
990988
///
991989
/// let mut map = HashMap::new();
@@ -996,7 +994,7 @@ where
996994
/// let vec: Vec<i32> = map.into_values().collect();
997995
/// ```
998996
#[inline]
999-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
997+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
1000998
pub fn into_values(self) -> IntoValues<K, V> {
1001999
IntoValues { inner: self.into_iter() }
10021000
}
@@ -1405,15 +1403,13 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> {
14051403
/// # Example
14061404
///
14071405
/// ```
1408-
/// #![feature(map_into_keys_values)]
1409-
///
14101406
/// use std::collections::HashMap;
14111407
///
14121408
/// let mut map = HashMap::new();
14131409
/// map.insert("a", 1);
14141410
/// let iter_keys = map.into_keys();
14151411
/// ```
1416-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1412+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
14171413
pub struct IntoKeys<K, V> {
14181414
inner: IntoIter<K, V>,
14191415
}
@@ -1428,15 +1424,13 @@ pub struct IntoKeys<K, V> {
14281424
/// # Example
14291425
///
14301426
/// ```
1431-
/// #![feature(map_into_keys_values)]
1432-
///
14331427
/// use std::collections::HashMap;
14341428
///
14351429
/// let mut map = HashMap::new();
14361430
/// map.insert("a", 1);
14371431
/// let iter_keys = map.into_values();
14381432
/// ```
1439-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
1433+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
14401434
pub struct IntoValues<K, V> {
14411435
inner: IntoIter<K, V>,
14421436
}
@@ -2137,7 +2131,7 @@ impl<K, V: fmt::Debug> fmt::Debug for ValuesMut<'_, K, V> {
21372131
}
21382132
}
21392133

2140-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
2134+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
21412135
impl<K, V> Iterator for IntoKeys<K, V> {
21422136
type Item = K;
21432137

@@ -2150,24 +2144,24 @@ impl<K, V> Iterator for IntoKeys<K, V> {
21502144
self.inner.size_hint()
21512145
}
21522146
}
2153-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
2147+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
21542148
impl<K, V> ExactSizeIterator for IntoKeys<K, V> {
21552149
#[inline]
21562150
fn len(&self) -> usize {
21572151
self.inner.len()
21582152
}
21592153
}
2160-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
2154+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
21612155
impl<K, V> FusedIterator for IntoKeys<K, V> {}
21622156

2163-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
2157+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
21642158
impl<K: Debug, V> fmt::Debug for IntoKeys<K, V> {
21652159
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21662160
f.debug_list().entries(self.inner.iter().map(|(k, _)| k)).finish()
21672161
}
21682162
}
21692163

2170-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
2164+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
21712165
impl<K, V> Iterator for IntoValues<K, V> {
21722166
type Item = V;
21732167

@@ -2180,17 +2174,17 @@ impl<K, V> Iterator for IntoValues<K, V> {
21802174
self.inner.size_hint()
21812175
}
21822176
}
2183-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
2177+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
21842178
impl<K, V> ExactSizeIterator for IntoValues<K, V> {
21852179
#[inline]
21862180
fn len(&self) -> usize {
21872181
self.inner.len()
21882182
}
21892183
}
2190-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
2184+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
21912185
impl<K, V> FusedIterator for IntoValues<K, V> {}
21922186

2193-
#[unstable(feature = "map_into_keys_values", issue = "75294")]
2187+
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
21942188
impl<K, V: Debug> fmt::Debug for IntoValues<K, V> {
21952189
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21962190
f.debug_list().entries(self.inner.iter().map(|(_, v)| v)).finish()

0 commit comments

Comments
 (0)