diff --git a/phf/src/map.rs b/phf/src/map.rs index f8a50ee0..613b1009 100644 --- a/phf/src/map.rs +++ b/phf/src/map.rs @@ -34,10 +34,10 @@ impl fmt::Debug for Map where K: fmt::Debug, V: fmt::Debug { } } -impl Index for Map where T: Eq + PhfHash, K: Borrow { +impl<'a, K, V, T: ?Sized> Index<&'a T> for Map where T: Eq + PhfHash, K: Borrow { type Output = V; - fn index(&self, k: &T) -> &V { + fn index(&self, k: &'a T) -> &V { self.get(k).expect("invalid key") } } diff --git a/phf/src/ordered_map.rs b/phf/src/ordered_map.rs index 4971fb77..bd88c3b5 100644 --- a/phf/src/ordered_map.rs +++ b/phf/src/ordered_map.rs @@ -40,10 +40,10 @@ impl fmt::Debug for OrderedMap where K: fmt::Debug, V: fmt::Debug { } } -impl Index for OrderedMap where T: Eq + PhfHash, K: Borrow { +impl<'a, K, V, T: ?Sized> Index<&'a T> for OrderedMap where T: Eq + PhfHash, K: Borrow { type Output = V; - fn index(&self, k: &T) -> &V { + fn index(&self, k: &'a T) -> &V { self.get(k).expect("invalid key") } } diff --git a/phf_codegen/src/lib.rs b/phf_codegen/src/lib.rs index 843da7bf..941e1a1a 100644 --- a/phf_codegen/src/lib.rs +++ b/phf_codegen/src/lib.rs @@ -10,6 +10,7 @@ //! build.rs //! //! ```rust,no_run +//! #![feature(std_misc)] //! extern crate phf_codegen; //! //! use std::fs::File; diff --git a/phf_codegen/test/src/lib.rs b/phf_codegen/test/src/lib.rs index 906d4333..ed2866fa 100644 --- a/phf_codegen/test/src/lib.rs +++ b/phf_codegen/test/src/lib.rs @@ -1,5 +1,3 @@ -#![cfg_attr(test, feature(core))] - extern crate phf; #[cfg(test)] @@ -8,9 +6,9 @@ mod test { #[test] fn map() { - assert_eq!("a", MAP[1]); - assert_eq!("b", MAP[2]); - assert_eq!("c", MAP[3]); + assert_eq!("a", MAP[&1]); + assert_eq!("b", MAP[&2]); + assert_eq!("c", MAP[&3]); assert!(!MAP.contains_key(&100)); } @@ -24,9 +22,9 @@ mod test { #[test] fn ordered_map() { - assert_eq!("a", ORDERED_MAP[1]); - assert_eq!("b", ORDERED_MAP[2]); - assert_eq!("c", ORDERED_MAP[3]); + assert_eq!("a", ORDERED_MAP[&1]); + assert_eq!("b", ORDERED_MAP[&2]); + assert_eq!("c", ORDERED_MAP[&3]); assert!(!ORDERED_MAP.contains_key(&100)); assert_eq!(&["a", "b", "c"][..], ORDERED_MAP.values().cloned().collect::>()); } diff --git a/phf_macros/src/lib.rs b/phf_macros/src/lib.rs index edc382f0..2ab70971 100644 --- a/phf_macros/src/lib.rs +++ b/phf_macros/src/lib.rs @@ -3,7 +3,7 @@ //! # Example //! //! ```rust -//! #![feature(plugin)] +//! #![feature(plugin, core)] //! #![plugin(phf_macros)] //! //! extern crate phf; @@ -31,7 +31,7 @@ //! # fn main() {} //! ``` #![doc(html_root_url="http://sfackler.github.io/rust-phf/doc")] -#![feature(plugin_registrar, quote, rustc_private, std_misc)] +#![feature(plugin_registrar, quote, rustc_private)] extern crate syntax; #[cfg(feature = "stats")] diff --git a/phf_shared/src/lib.rs b/phf_shared/src/lib.rs index e4c8a953..36f52feb 100644 --- a/phf_shared/src/lib.rs +++ b/phf_shared/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(hash)] #![doc(html_root_url="http://sfackler.github.io/rust-phf/doc")] use std::hash::{Hasher, Hash, SipHasher};