Skip to content

Commit ceee2c8

Browse files
authored
Rollup merge of rust-lang#75203 - canova:btreemap-into-iter, r=dtolnay
Make `IntoIterator` lifetime bounds of `&BTreeMap` match with `&HashMap` This is a pretty small change on the lifetime bounds of `IntoIterator` implementations of both `&BTreeMap` and `&mut BTreeMap`. This is loosening the lifetime bounds, so more code should be accepted with this PR. This is lifetime bounds will still be implicit since we have `type Item = (&'a K, &'a V);` in the implementation. This change will make the HashMap and BTreeMap share the same signature, so we can share the same function/trait with both HashMap and BTreeMap in the code. Fixes rust-lang#74034. r? @dtolnay hey, I was touching this file on my previous PR and wanted to fix this on the way. Would you mind taking a look at this, or redirecting it if you are busy?
2 parents d8dd1b2 + f0a6338 commit ceee2c8

File tree

1 file changed

+2
-2
lines changed
  • alloc/src/collections/btree

1 file changed

+2
-2
lines changed

alloc/src/collections/btree/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
12941294
}
12951295

12961296
#[stable(feature = "rust1", since = "1.0.0")]
1297-
impl<'a, K: 'a, V: 'a> IntoIterator for &'a BTreeMap<K, V> {
1297+
impl<'a, K, V> IntoIterator for &'a BTreeMap<K, V> {
12981298
type Item = (&'a K, &'a V);
12991299
type IntoIter = Iter<'a, K, V>;
13001300

@@ -1363,7 +1363,7 @@ impl<K, V> Clone for Iter<'_, K, V> {
13631363
}
13641364

13651365
#[stable(feature = "rust1", since = "1.0.0")]
1366-
impl<'a, K: 'a, V: 'a> IntoIterator for &'a mut BTreeMap<K, V> {
1366+
impl<'a, K, V> IntoIterator for &'a mut BTreeMap<K, V> {
13671367
type Item = (&'a K, &'a mut V);
13681368
type IntoIter = IterMut<'a, K, V>;
13691369

0 commit comments

Comments
 (0)