Skip to content

Commit c842223

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 168661 b: refs/heads/batch c: 4bfaa93 h: refs/heads/master i: 168659: 2c69e03 v: v3
1 parent 0846f18 commit c842223

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/issue-18208-method-dispatch-2: 9e1eae4fb9b6527315b4441cf8a0f5ca911d1671
3030
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
32-
refs/heads/batch: 32dd592d36c731fd3bbd0cda8040d33b44a90f4b
32+
refs/heads/batch: 4bfaa9397857b5b49657e3596e33800dbf35ade4
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970

branches/batch/src/libstd/collections/hash/map.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,8 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> Default for HashMap<K, V, H>
13001300
}
13011301
}
13021302

1303+
// NOTE(stage0): remove impl after a snapshot
1304+
#[cfg(stage0)]
13031305
#[stable]
13041306
impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q, V> for HashMap<K, V, H>
13051307
where Q: BorrowFrom<K> + Hash<S> + Eq
@@ -1310,6 +1312,21 @@ impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q, V> for HashMap<K, V
13101312
}
13111313
}
13121314

1315+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
1316+
#[stable]
1317+
impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q> for HashMap<K, V, H>
1318+
where Q: BorrowFrom<K> + Hash<S> + Eq
1319+
{
1320+
type Output = V;
1321+
1322+
#[inline]
1323+
fn index<'a>(&'a self, index: &Q) -> &'a V {
1324+
self.get(index).expect("no entry found for key")
1325+
}
1326+
}
1327+
1328+
// NOTE(stage0): remove impl after a snapshot
1329+
#[cfg(stage0)]
13131330
#[stable]
13141331
impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q, V> for HashMap<K, V, H>
13151332
where Q: BorrowFrom<K> + Hash<S> + Eq
@@ -1320,6 +1337,19 @@ impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q, V> for HashMap<K
13201337
}
13211338
}
13221339

1340+
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
1341+
#[stable]
1342+
impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q> for HashMap<K, V, H>
1343+
where Q: BorrowFrom<K> + Hash<S> + Eq
1344+
{
1345+
type Output = V;
1346+
1347+
#[inline]
1348+
fn index_mut<'a>(&'a mut self, index: &Q) -> &'a mut V {
1349+
self.get_mut(index).expect("no entry found for key")
1350+
}
1351+
}
1352+
13231353
/// HashMap iterator
13241354
#[stable]
13251355
pub struct Iter<'a, K: 'a, V: 'a> {

0 commit comments

Comments
 (0)