Skip to content

Commit 4bfaa93

Browse files
author
Jorge Aparicio
committed
std: fix fallout
1 parent 32dd592 commit 4bfaa93

File tree

1 file changed

+30
-0
lines changed
  • src/libstd/collections/hash

1 file changed

+30
-0
lines changed

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)