diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-03 10:40:19 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-03 16:30:49 -0500 |
| commit | 4bfaa9397857b5b49657e3596e33800dbf35ade4 (patch) | |
| tree | d74185e435917e9fd7bc96217a2db0b2048339bf /src/libstd/collections | |
| parent | 32dd592d36c731fd3bbd0cda8040d33b44a90f4b (diff) | |
| download | rust-4bfaa9397857b5b49657e3596e33800dbf35ade4.tar.gz rust-4bfaa9397857b5b49657e3596e33800dbf35ade4.zip | |
std: fix fallout
Diffstat (limited to 'src/libstd/collections')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 6450b149d02..f246e9df3b9 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1300,6 +1300,8 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> Default for HashMap<K, V, H> } } +// NOTE(stage0): remove impl after a snapshot +#[cfg(stage0)] #[stable] impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q, V> for HashMap<K, V, H> 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 } } +#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot +#[stable] +impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q> for HashMap<K, V, H> + where Q: BorrowFrom<K> + Hash<S> + Eq +{ + type Output = V; + + #[inline] + fn index<'a>(&'a self, index: &Q) -> &'a V { + self.get(index).expect("no entry found for key") + } +} + +// NOTE(stage0): remove impl after a snapshot +#[cfg(stage0)] #[stable] impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q, V> for HashMap<K, V, H> 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 } } +#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot +#[stable] +impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q> for HashMap<K, V, H> + where Q: BorrowFrom<K> + Hash<S> + Eq +{ + type Output = V; + + #[inline] + fn index_mut<'a>(&'a mut self, index: &Q) -> &'a mut V { + self.get_mut(index).expect("no entry found for key") + } +} + /// HashMap iterator #[stable] pub struct Iter<'a, K: 'a, V: 'a> { |
