@@ -1300,6 +1300,8 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> Default for HashMap<K, V, H>
1300
1300
}
1301
1301
}
1302
1302
1303
+ // NOTE(stage0): remove impl after a snapshot
1304
+ #[ cfg( stage0) ]
1303
1305
#[ stable]
1304
1306
impl < K : Hash < S > + Eq , Sized ? Q , V , S , H : Hasher < S > > Index < Q , V > for HashMap < K , V , H >
1305
1307
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
1310
1312
}
1311
1313
}
1312
1314
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) ]
1313
1330
#[ stable]
1314
1331
impl < K : Hash < S > + Eq , Sized ? Q , V , S , H : Hasher < S > > IndexMut < Q , V > for HashMap < K , V , H >
1315
1332
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
1320
1337
}
1321
1338
}
1322
1339
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
+
1323
1353
/// HashMap iterator
1324
1354
#[ stable]
1325
1355
pub struct Iter < ' a , K : ' a , V : ' a > {
0 commit comments