diff --git a/phf/src/lib.rs b/phf/src/lib.rs index 894dde39..05893fd2 100644 --- a/phf/src/lib.rs +++ b/phf/src/lib.rs @@ -4,7 +4,7 @@ //! literals, or any of the fixed-size integral types. #![doc(html_root_url="https://sfackler.github.io/doc")] #![warn(missing_docs)] -#![feature(macro_rules, phase, globs)] +#![feature(macro_rules, phase, globs, old_orphan_check)] #![no_std] #[phase(plugin, link)] diff --git a/phf/src/map.rs b/phf/src/map.rs index a1be50ba..92c04198 100644 --- a/phf/src/map.rs +++ b/phf/src/map.rs @@ -1,6 +1,7 @@ //! An immutable map constructed at compile time. use core::prelude::*; use core::borrow::BorrowFrom; +use core::ops::Index; use core::slice; use core::fmt; use PhfHash; diff --git a/phf/src/ordered_map.rs b/phf/src/ordered_map.rs index 6a0ee521..521282e4 100644 --- a/phf/src/ordered_map.rs +++ b/phf/src/ordered_map.rs @@ -1,6 +1,8 @@ //! An order-preserving immutable map constructed at compile time. use core::prelude::*; use core::borrow::BorrowFrom; +use core::iter::RandomAccessIterator; +use core::ops::Index; use core::fmt; use core::slice; diff --git a/phf/src/ordered_set.rs b/phf/src/ordered_set.rs index b217ba6f..115644a9 100644 --- a/phf/src/ordered_set.rs +++ b/phf/src/ordered_set.rs @@ -1,6 +1,7 @@ //! An order-preserving immutable set constructed at compile time. use core::prelude::*; use core::borrow::BorrowFrom; +use core::iter::RandomAccessIterator; use core::fmt; use ordered_map; use {PhfHash, OrderedMap}; diff --git a/phf/tests/test.rs b/phf/tests/test.rs index 5eafb83a..bbbe4dd6 100644 --- a/phf/tests/test.rs +++ b/phf/tests/test.rs @@ -145,7 +145,7 @@ mod map { #[test] fn test_array_vals() { - static MAP: phf::Map<&'static str, [u8, ..3]> = phf_map!( + static MAP: phf::Map<&'static str, [u8; 3]> = phf_map!( "a" => [0u8, 1, 2], ); assert_eq!(Some(&[0u8, 1, 2]), MAP.get(&("a"))); @@ -153,7 +153,7 @@ mod map { #[test] fn test_array_keys() { - static MAP: phf::Map<[u8, ..2], int> = phf_map!( + static MAP: phf::Map<[u8; 2], int> = phf_map!( [0u8, 1] => 0, [2, 3u8] => 1, [4, 5] => 2, @@ -271,6 +271,8 @@ mod set { } mod ordered_map { + use std::iter::RandomAccessIterator; + use phf; #[allow(dead_code)] @@ -372,6 +374,7 @@ mod ordered_map { } mod ordered_set { + use std::iter::RandomAccessIterator; use phf; #[allow(dead_code)] diff --git a/phf_mac/src/lib.rs b/phf_mac/src/lib.rs index d80d39fc..c172c4bc 100644 --- a/phf_mac/src/lib.rs +++ b/phf_mac/src/lib.rs @@ -2,7 +2,7 @@ //! //! See the documentation for the `phf` crate for more details. #![doc(html_root_url="http://sfackler.github.io/doc")] -#![feature(plugin_registrar, quote, default_type_params, macro_rules)] +#![feature(plugin_registrar, quote, default_type_params, macro_rules, old_orphan_check)] #![allow(unknown_features)] extern crate rand; @@ -13,7 +13,7 @@ extern crate phf_shared; use std::collections::HashMap; use std::collections::hash_map::Entry::{Occupied, Vacant}; -use syntax::ast::{mod, TokenTree, LitStr, LitBinary, LitByte, LitChar, Expr, ExprLit, ExprVec}; +use syntax::ast::{self, TokenTree, LitStr, LitBinary, LitByte, LitChar, Expr, ExprLit, ExprVec}; use syntax::codemap::{Span, Spanned}; use syntax::ext::base::{DummyResult, ExtCtxt, diff --git a/phf_mac/src/util.rs b/phf_mac/src/util.rs index a66cfe08..f08f4311 100644 --- a/phf_mac/src/util.rs +++ b/phf_mac/src/util.rs @@ -1,7 +1,7 @@ use std::os; use std::rc::Rc; -use std::hash; -use std::hash::Hash; +use std::hash::{self, Hash}; +use std::iter::repeat; use syntax::ast::Expr; use syntax::codemap::Span; @@ -11,15 +11,15 @@ use syntax::parse::token::InternedString; use syntax::ptr::P; use rand::{Rng, SeedableRng, XorShiftRng}; -use phf_shared::{mod, PhfHash}; +use phf_shared::{self, PhfHash}; use time; const DEFAULT_LAMBDA: uint = 5; -const FIXED_SEED: [u32, ..4] = [3141592653, 589793238, 462643383, 2795028841]; +const FIXED_SEED: [u32; 4] = [3141592653, 589793238, 462643383, 2795028841]; -#[deriving(PartialEq, Eq, Clone)] +#[derive(PartialEq, Eq, Clone)] pub enum Key { Str(InternedString), Binary(Rc>), @@ -130,7 +130,9 @@ pub fn try_generate_hash(entries: &[Entry], rng: &mut XorShiftRng) -> Option>(); for (i, hash) in hashes.iter().enumerate() { buckets[(hash.g % (buckets_len as u32)) as uint].keys.push(i); @@ -140,8 +142,8 @@ pub fn try_generate_hash(entries: &[Entry], rng: &mut XorShiftRng) -> Option>(); + let mut disps = repeat((0u32, 0u32)).take(buckets_len).collect::>(); // store whether an element from the bucket being placed is // located at a certain position, to allow for efficient overlap @@ -150,7 +152,7 @@ pub fn try_generate_hash(entries: &[Entry], rng: &mut XorShiftRng) -> Option>(); let mut generation = 0u64; // the actual values corresponding to the markers above, as diff --git a/phf_shared/src/lib.rs b/phf_shared/src/lib.rs index 09a2b070..f4fc005a 100644 --- a/phf_shared/src/lib.rs +++ b/phf_shared/src/lib.rs @@ -5,7 +5,7 @@ extern crate core; use core::slice::AsSlice; use core::str::StrExt; use core::hash::Writer; -use core::hash::sip::{mod, SipState}; +use core::hash::sip::{self, SipState}; use core::kinds::Sized; #[inline] @@ -84,7 +84,7 @@ sip_impl!(bool); macro_rules! array_impl( ($t:ty, $n:expr) => ( - impl PhfHash for [$t, ..$n] { + impl PhfHash for [$t; $n] { #[inline] fn phf_hash(&self, seed: u64) -> (u32, u32, u32) { split(sip::hash_with_keys(seed, 0, self.as_slice()))