From: Jorge Aparicio Date: Sat, 3 Jan 2015 15:40:19 +0000 (-0500) Subject: std: fix fallout X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=4bfaa9397857b5b49657e3596e33800dbf35ade4;p=rust.git std: fix fallout --- 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 @@ fn default() -> HashMap { } } +// NOTE(stage0): remove impl after a snapshot +#[cfg(stage0)] #[stable] impl + Eq, Sized? Q, V, S, H: Hasher> Index for HashMap where Q: BorrowFrom + Hash + Eq @@ -1310,6 +1312,21 @@ fn index<'a>(&'a self, index: &Q) -> &'a V { } } +#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot +#[stable] +impl + Eq, Sized? Q, V, S, H: Hasher> Index for HashMap + where Q: BorrowFrom + Hash + 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 + Eq, Sized? Q, V, S, H: Hasher> IndexMut for HashMap where Q: BorrowFrom + Hash + Eq @@ -1320,6 +1337,19 @@ fn index_mut<'a>(&'a mut self, index: &Q) -> &'a mut V { } } +#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot +#[stable] +impl + Eq, Sized? Q, V, S, H: Hasher> IndexMut for HashMap + where Q: BorrowFrom + Hash + 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> {