Replace FnvHasher use with FxHasher.

This speeds up compilation by 3--6% across most of rustc-benchmarks.
This commit is contained in:
Nicholas Nethercote 2016-11-08 14:02:55 +11:00
parent eca1cc957f
commit 00e48affde
91 changed files with 588 additions and 588 deletions

View file

@ -9,7 +9,7 @@
// except according to those terms.
use hir::def_id::DefId;
use rustc_data_structures::fnv::FnvHashMap;
use rustc_data_structures::fx::FxHashMap;
use std::cell::RefCell;
use std::ops::Index;
use std::hash::Hash;
@ -24,7 +24,7 @@ use super::{DepNode, DepGraph};
pub struct DepTrackingMap<M: DepTrackingMapConfig> {
phantom: PhantomData<M>,
graph: DepGraph,
map: FnvHashMap<M::Key, M::Value>,
map: FxHashMap<M::Key, M::Value>,
}
pub trait DepTrackingMapConfig {
@ -38,7 +38,7 @@ impl<M: DepTrackingMapConfig> DepTrackingMap<M> {
DepTrackingMap {
phantom: PhantomData,
graph: graph,
map: FnvHashMap()
map: FxHashMap()
}
}

View file

@ -8,15 +8,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use rustc_data_structures::fnv::{FnvHashMap, FnvHashSet};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use std::fmt::Debug;
use std::hash::Hash;
use super::{DepGraphQuery, DepNode};
pub struct DepGraphEdges<D: Clone + Debug + Eq + Hash> {
nodes: Vec<DepNode<D>>,
indices: FnvHashMap<DepNode<D>, IdIndex>,
edges: FnvHashSet<(IdIndex, IdIndex)>,
indices: FxHashMap<DepNode<D>, IdIndex>,
edges: FxHashSet<(IdIndex, IdIndex)>,
open_nodes: Vec<OpenNode>,
}
@ -46,8 +46,8 @@ impl<D: Clone + Debug + Eq + Hash> DepGraphEdges<D> {
pub fn new() -> DepGraphEdges<D> {
DepGraphEdges {
nodes: vec![],
indices: FnvHashMap(),
edges: FnvHashSet(),
indices: FxHashMap(),
edges: FxHashSet(),
open_nodes: Vec::new()
}
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
use hir::def_id::DefId;
use rustc_data_structures::fnv::FnvHashMap;
use rustc_data_structures::fx::FxHashMap;
use session::config::OutputType;
use std::cell::{Ref, RefCell};
use std::rc::Rc;
@ -34,10 +34,10 @@ struct DepGraphData {
/// things available to us. If we find that they are not dirty, we
/// load the path to the file storing those work-products here into
/// this map. We can later look for and extract that data.
previous_work_products: RefCell<FnvHashMap<Arc<WorkProductId>, WorkProduct>>,
previous_work_products: RefCell<FxHashMap<Arc<WorkProductId>, WorkProduct>>,
/// Work-products that we generate in this run.
work_products: RefCell<FnvHashMap<Arc<WorkProductId>, WorkProduct>>,
work_products: RefCell<FxHashMap<Arc<WorkProductId>, WorkProduct>>,
}
impl DepGraph {
@ -45,8 +45,8 @@ impl DepGraph {
DepGraph {
data: Rc::new(DepGraphData {
thread: DepGraphThreadData::new(enabled),
previous_work_products: RefCell::new(FnvHashMap()),
work_products: RefCell::new(FnvHashMap()),
previous_work_products: RefCell::new(FxHashMap()),
work_products: RefCell::new(FxHashMap()),
})
}
}
@ -117,7 +117,7 @@ impl DepGraph {
/// Access the map of work-products created during this run. Only
/// used during saving of the dep-graph.
pub fn work_products(&self) -> Ref<FnvHashMap<Arc<WorkProductId>, WorkProduct>> {
pub fn work_products(&self) -> Ref<FxHashMap<Arc<WorkProductId>, WorkProduct>> {
self.data.work_products.borrow()
}
}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use rustc_data_structures::fnv::FnvHashMap;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::graph::{Direction, INCOMING, Graph, NodeIndex, OUTGOING};
use std::fmt::Debug;
use std::hash::Hash;
@ -17,7 +17,7 @@ use super::DepNode;
pub struct DepGraphQuery<D: Clone + Debug + Hash + Eq> {
pub graph: Graph<DepNode<D>, ()>,
pub indices: FnvHashMap<DepNode<D>, NodeIndex>,
pub indices: FxHashMap<DepNode<D>, NodeIndex>,
}
impl<D: Clone + Debug + Hash + Eq> DepGraphQuery<D> {
@ -25,7 +25,7 @@ impl<D: Clone + Debug + Hash + Eq> DepGraphQuery<D> {
edges: &[(DepNode<D>, DepNode<D>)])
-> DepGraphQuery<D> {
let mut graph = Graph::new();
let mut indices = FnvHashMap();
let mut indices = FxHashMap();
for node in nodes {
indices.insert(node.clone(), graph.next_node_index());
graph.add_node(node.clone());

View file

@ -9,7 +9,7 @@
// except according to those terms.
use hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE};
use rustc_data_structures::fnv::FnvHashMap;
use rustc_data_structures::fx::FxHashMap;
use std::fmt::Write;
use std::hash::{Hash, Hasher};
use std::collections::hash_map::DefaultHasher;
@ -22,7 +22,7 @@ use util::nodemap::NodeMap;
#[derive(Clone)]
pub struct Definitions {
data: Vec<DefData>,
key_map: FnvHashMap<DefKey, DefIndex>,
key_map: FxHashMap<DefKey, DefIndex>,
node_map: NodeMap<DefIndex>,
}
@ -219,7 +219,7 @@ impl Definitions {
pub fn new() -> Definitions {
Definitions {
data: vec![],
key_map: FnvHashMap(),
key_map: FxHashMap(),
node_map: NodeMap(),
}
}

View file

@ -33,7 +33,7 @@ pub use self::PathParameters::*;
use hir::def::Def;
use hir::def_id::DefId;
use util::nodemap::{NodeMap, FnvHashSet};
use util::nodemap::{NodeMap, FxHashSet};
use syntax_pos::{mk_sp, Span, ExpnId, DUMMY_SP};
use syntax::codemap::{self, respan, Spanned};
@ -1605,4 +1605,4 @@ pub type TraitMap = NodeMap<Vec<TraitCandidate>>;
// Map from the NodeId of a glob import to a list of items which are actually
// imported.
pub type GlobMap = NodeMap<FnvHashSet<Name>>;
pub type GlobMap = NodeMap<FxHashSet<Name>>;

View file

@ -32,7 +32,7 @@
use ty::{self, Ty, TyCtxt, TypeFoldable};
use ty::fold::TypeFolder;
use util::nodemap::FnvHashMap;
use util::nodemap::FxHashMap;
use std::collections::hash_map::Entry;
use super::InferCtxt;
@ -41,7 +41,7 @@ use super::unify_key::ToType;
pub struct TypeFreshener<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
freshen_count: u32,
freshen_map: FnvHashMap<ty::InferTy, Ty<'tcx>>,
freshen_map: FxHashMap<ty::InferTy, Ty<'tcx>>,
}
impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> {
@ -50,7 +50,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> {
TypeFreshener {
infcx: infcx,
freshen_count: 0,
freshen_map: FnvHashMap(),
freshen_map: FxHashMap(),
}
}

View file

@ -24,7 +24,7 @@ use ty::{self, TyCtxt, Binder, TypeFoldable};
use ty::error::TypeError;
use ty::relate::{Relate, RelateResult, TypeRelation};
use syntax_pos::Span;
use util::nodemap::{FnvHashMap, FnvHashSet};
use util::nodemap::{FxHashMap, FxHashSet};
pub struct HrMatchResult<U> {
pub value: U,
@ -135,7 +135,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
// Map each skolemized region to a vector of other regions that it
// must be equated with. (Note that this vector may include other
// skolemized regions from `skol_map`.)
let skol_resolution_map: FnvHashMap<_, _> =
let skol_resolution_map: FxHashMap<_, _> =
skol_map
.iter()
.map(|(&br, &skol)| {
@ -158,7 +158,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
// `skol_map`. There should always be a representative if things
// are properly well-formed.
let mut unconstrained_regions = vec![];
let skol_representatives: FnvHashMap<_, _> =
let skol_representatives: FxHashMap<_, _> =
skol_resolution_map
.iter()
.map(|(&skol, &(br, ref regions))| {
@ -268,7 +268,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
snapshot: &CombinedSnapshot,
debruijn: ty::DebruijnIndex,
new_vars: &[ty::RegionVid],
a_map: &FnvHashMap<ty::BoundRegion, &'tcx ty::Region>,
a_map: &FxHashMap<ty::BoundRegion, &'tcx ty::Region>,
r0: &'tcx ty::Region)
-> &'tcx ty::Region {
// Regions that pre-dated the LUB computation stay as they are.
@ -364,8 +364,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
snapshot: &CombinedSnapshot,
debruijn: ty::DebruijnIndex,
new_vars: &[ty::RegionVid],
a_map: &FnvHashMap<ty::BoundRegion,
&'tcx ty::Region>,
a_map: &FxHashMap<ty::BoundRegion, &'tcx ty::Region>,
a_vars: &[ty::RegionVid],
b_vars: &[ty::RegionVid],
r0: &'tcx ty::Region)
@ -434,7 +433,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
fn rev_lookup<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
span: Span,
a_map: &FnvHashMap<ty::BoundRegion, &'tcx ty::Region>,
a_map: &FxHashMap<ty::BoundRegion, &'tcx ty::Region>,
r: &'tcx ty::Region) -> &'tcx ty::Region
{
for (a_br, a_r) in a_map {
@ -457,7 +456,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
}
fn var_ids<'a, 'gcx, 'tcx>(fields: &CombineFields<'a, 'gcx, 'tcx>,
map: &FnvHashMap<ty::BoundRegion, &'tcx ty::Region>)
map: &FxHashMap<ty::BoundRegion, &'tcx ty::Region>)
-> Vec<ty::RegionVid> {
map.iter()
.map(|(_, &r)| match *r {
@ -504,7 +503,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
snapshot: &CombinedSnapshot,
r: &'tcx ty::Region,
directions: TaintDirections)
-> FnvHashSet<&'tcx ty::Region> {
-> FxHashSet<&'tcx ty::Region> {
self.region_vars.tainted(&snapshot.region_vars_snapshot, r, directions)
}
@ -568,7 +567,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let escaping_types =
self.type_variables.borrow_mut().types_escaping_snapshot(&snapshot.type_snapshot);
let mut escaping_region_vars = FnvHashSet();
let mut escaping_region_vars = FxHashSet();
for ty in &escaping_types {
self.tcx.collect_regions(ty, &mut escaping_region_vars);
}
@ -764,7 +763,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
// region back to the `ty::BoundRegion` that it originally
// represented. Because `leak_check` passed, we know that
// these taint sets are mutually disjoint.
let inv_skol_map: FnvHashMap<&'tcx ty::Region, ty::BoundRegion> =
let inv_skol_map: FxHashMap<&'tcx ty::Region, ty::BoundRegion> =
skol_map
.iter()
.flat_map(|(&skol_br, &skol)| {
@ -837,7 +836,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
snapshot: &CombinedSnapshot)
{
debug!("pop_skolemized({:?})", skol_map);
let skol_regions: FnvHashSet<_> = skol_map.values().cloned().collect();
let skol_regions: FxHashSet<_> = skol_map.values().cloned().collect();
self.region_vars.pop_skolemized(&skol_regions, &snapshot.region_vars_snapshot);
if !skol_map.is_empty() {
self.projection_cache.borrow_mut().rollback_skolemized(

View file

@ -39,7 +39,7 @@ use std::fmt;
use syntax::ast;
use errors::DiagnosticBuilder;
use syntax_pos::{self, Span, DUMMY_SP};
use util::nodemap::{FnvHashMap, FnvHashSet, NodeMap};
use util::nodemap::{FxHashMap, FxHashSet, NodeMap};
use self::combine::CombineFields;
use self::higher_ranked::HrMatchResult;
@ -134,7 +134,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
// the set of predicates on which errors have been reported, to
// avoid reporting the same error twice.
pub reported_trait_errors: RefCell<FnvHashSet<traits::TraitErrorKey<'tcx>>>,
pub reported_trait_errors: RefCell<FxHashSet<traits::TraitErrorKey<'tcx>>>,
// Sadly, the behavior of projection varies a bit depending on the
// stage of compilation. The specifics are given in the
@ -170,7 +170,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
/// A map returned by `skolemize_late_bound_regions()` indicating the skolemized
/// region that each late-bound region was replaced with.
pub type SkolemizationMap<'tcx> = FnvHashMap<ty::BoundRegion, &'tcx ty::Region>;
pub type SkolemizationMap<'tcx> = FxHashMap<ty::BoundRegion, &'tcx ty::Region>;
/// Why did we require that the two types be related?
///
@ -492,7 +492,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'gcx> {
selection_cache: traits::SelectionCache::new(),
evaluation_cache: traits::EvaluationCache::new(),
projection_cache: RefCell::new(traits::ProjectionCache::new()),
reported_trait_errors: RefCell::new(FnvHashSet()),
reported_trait_errors: RefCell::new(FxHashSet()),
projection_mode: Reveal::NotSpecializable,
tainted_by_errors_flag: Cell::new(false),
err_count_on_creation: self.sess.err_count(),
@ -531,7 +531,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> {
parameter_environment: param_env,
selection_cache: traits::SelectionCache::new(),
evaluation_cache: traits::EvaluationCache::new(),
reported_trait_errors: RefCell::new(FnvHashSet()),
reported_trait_errors: RefCell::new(FxHashSet()),
projection_mode: projection_mode,
tainted_by_errors_flag: Cell::new(false),
err_count_on_creation: tcx.sess.err_count(),
@ -1530,7 +1530,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
span: Span,
lbrct: LateBoundRegionConversionTime,
value: &ty::Binder<T>)
-> (T, FnvHashMap<ty::BoundRegion, &'tcx ty::Region>)
-> (T, FxHashMap<ty::BoundRegion, &'tcx ty::Region>)
where T : TypeFoldable<'tcx>
{
self.tcx.replace_late_bound_regions(

View file

@ -23,7 +23,7 @@ use middle::region::CodeExtent;
use super::Constraint;
use infer::SubregionOrigin;
use infer::region_inference::RegionVarBindings;
use util::nodemap::{FnvHashMap, FnvHashSet};
use util::nodemap::{FxHashMap, FxHashSet};
use std::borrow::Cow;
use std::collections::hash_map::Entry::Vacant;
@ -122,8 +122,8 @@ pub fn maybe_print_constraints_for<'a, 'gcx, 'tcx>(
struct ConstraintGraph<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
tcx: TyCtxt<'a, 'gcx, 'tcx>,
graph_name: String,
map: &'a FnvHashMap<Constraint<'tcx>, SubregionOrigin<'tcx>>,
node_ids: FnvHashMap<Node, usize>,
map: &'a FxHashMap<Constraint<'tcx>, SubregionOrigin<'tcx>>,
node_ids: FxHashMap<Node, usize>,
}
#[derive(Clone, Hash, PartialEq, Eq, Debug, Copy)]
@ -145,7 +145,7 @@ impl<'a, 'gcx, 'tcx> ConstraintGraph<'a, 'gcx, 'tcx> {
map: &'a ConstraintMap<'tcx>)
-> ConstraintGraph<'a, 'gcx, 'tcx> {
let mut i = 0;
let mut node_ids = FnvHashMap();
let mut node_ids = FxHashMap();
{
let mut add_node = |node| {
if let Vacant(e) = node_ids.entry(node) {
@ -235,7 +235,7 @@ impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
type Node = Node;
type Edge = Edge<'tcx>;
fn nodes(&self) -> dot::Nodes<Node> {
let mut set = FnvHashSet();
let mut set = FxHashSet();
for node in self.node_ids.keys() {
set.insert(*node);
}
@ -261,7 +261,7 @@ impl<'a, 'gcx, 'tcx> dot::GraphWalk<'a> for ConstraintGraph<'a, 'gcx, 'tcx> {
}
}
pub type ConstraintMap<'tcx> = FnvHashMap<Constraint<'tcx>, SubregionOrigin<'tcx>>;
pub type ConstraintMap<'tcx> = FxHashMap<Constraint<'tcx>, SubregionOrigin<'tcx>>;
fn dump_region_constraints_to<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
map: &ConstraintMap<'tcx>,

View file

@ -19,7 +19,7 @@ pub use self::VarValue::*;
use super::{RegionVariableOrigin, SubregionOrigin, MiscVariable};
use super::unify_key;
use rustc_data_structures::fnv::{FnvHashMap, FnvHashSet};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::graph::{self, Direction, NodeIndex, OUTGOING};
use rustc_data_structures::unify::{self, UnificationTable};
use middle::free_region::FreeRegionMap;
@ -213,7 +213,7 @@ impl SameRegions {
}
}
pub type CombineMap<'tcx> = FnvHashMap<TwoRegions<'tcx>, RegionVid>;
pub type CombineMap<'tcx> = FxHashMap<TwoRegions<'tcx>, RegionVid>;
pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
tcx: TyCtxt<'a, 'gcx, 'tcx>,
@ -222,7 +222,7 @@ pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
// Constraints of the form `A <= B` introduced by the region
// checker. Here at least one of `A` and `B` must be a region
// variable.
constraints: RefCell<FnvHashMap<Constraint<'tcx>, SubregionOrigin<'tcx>>>,
constraints: RefCell<FxHashMap<Constraint<'tcx>, SubregionOrigin<'tcx>>>,
// A "verify" is something that we need to verify after inference is
// done, but which does not directly affect inference in any way.
@ -248,7 +248,7 @@ pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
// record the fact that `'a <= 'b` is implied by the fn signature,
// and then ignore the constraint when solving equations. This is
// a bit of a hack but seems to work.
givens: RefCell<FnvHashSet<(ty::FreeRegion, ty::RegionVid)>>,
givens: RefCell<FxHashSet<(ty::FreeRegion, ty::RegionVid)>>,
lubs: RefCell<CombineMap<'tcx>>,
glbs: RefCell<CombineMap<'tcx>>,
@ -305,14 +305,14 @@ impl TaintDirections {
struct TaintSet<'tcx> {
directions: TaintDirections,
regions: FnvHashSet<&'tcx ty::Region>
regions: FxHashSet<&'tcx ty::Region>
}
impl<'a, 'gcx, 'tcx> TaintSet<'tcx> {
fn new(directions: TaintDirections,
initial_region: &'tcx ty::Region)
-> Self {
let mut regions = FnvHashSet();
let mut regions = FxHashSet();
regions.insert(initial_region);
TaintSet { directions: directions, regions: regions }
}
@ -362,7 +362,7 @@ impl<'a, 'gcx, 'tcx> TaintSet<'tcx> {
}
}
fn into_set(self) -> FnvHashSet<&'tcx ty::Region> {
fn into_set(self) -> FxHashSet<&'tcx ty::Region> {
self.regions
}
@ -393,11 +393,11 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
tcx: tcx,
var_origins: RefCell::new(Vec::new()),
values: RefCell::new(None),
constraints: RefCell::new(FnvHashMap()),
constraints: RefCell::new(FxHashMap()),
verifys: RefCell::new(Vec::new()),
givens: RefCell::new(FnvHashSet()),
lubs: RefCell::new(FnvHashMap()),
glbs: RefCell::new(FnvHashMap()),
givens: RefCell::new(FxHashSet()),
lubs: RefCell::new(FxHashMap()),
glbs: RefCell::new(FxHashMap()),
skolemization_count: Cell::new(0),
bound_count: Cell::new(0),
undo_log: RefCell::new(Vec::new()),
@ -547,7 +547,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
/// completes to remove all trace of the skolemized regions
/// created in that time.
pub fn pop_skolemized(&self,
skols: &FnvHashSet<&'tcx ty::Region>,
skols: &FxHashSet<&'tcx ty::Region>,
snapshot: &RegionSnapshot) {
debug!("pop_skolemized_regions(skols={:?})", skols);
@ -601,7 +601,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
self.skolemization_count.set(snapshot.skolemization_count);
return;
fn kill_constraint<'tcx>(skols: &FnvHashSet<&'tcx ty::Region>,
fn kill_constraint<'tcx>(skols: &FxHashSet<&'tcx ty::Region>,
undo_entry: &UndoLogEntry<'tcx>)
-> bool {
match undo_entry {
@ -905,7 +905,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
mark: &RegionSnapshot,
r0: &'tcx Region,
directions: TaintDirections)
-> FnvHashSet<&'tcx ty::Region> {
-> FxHashSet<&'tcx ty::Region> {
debug!("tainted(mark={:?}, r0={:?}, directions={:?})",
mark, r0, directions);
@ -1414,13 +1414,13 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
dup_vec: &mut [u32])
-> (Vec<RegionAndOrigin<'tcx>>, bool) {
struct WalkState<'tcx> {
set: FnvHashSet<RegionVid>,
set: FxHashSet<RegionVid>,
stack: Vec<RegionVid>,
result: Vec<RegionAndOrigin<'tcx>>,
dup_found: bool,
}
let mut state = WalkState {
set: FnvHashSet(),
set: FxHashSet(),
stack: vec![orig_node_idx],
result: Vec::new(),
dup_found: false,

View file

@ -33,7 +33,7 @@ use lint::{Level, LevelSource, Lint, LintId, LintPass, LintSource};
use lint::{EarlyLintPassObject, LateLintPassObject};
use lint::{Default, CommandLine, Node, Allow, Warn, Deny, Forbid};
use lint::builtin;
use util::nodemap::FnvHashMap;
use util::nodemap::FxHashMap;
use std::cmp;
use std::default::Default as StdDefault;
@ -64,18 +64,18 @@ pub struct LintStore {
late_passes: Option<Vec<LateLintPassObject>>,
/// Lints indexed by name.
by_name: FnvHashMap<String, TargetLint>,
by_name: FxHashMap<String, TargetLint>,
/// Current levels of each lint, and where they were set.
levels: FnvHashMap<LintId, LevelSource>,
levels: FxHashMap<LintId, LevelSource>,
/// Map of registered lint groups to what lints they expand to. The bool
/// is true if the lint group was added by a plugin.
lint_groups: FnvHashMap<&'static str, (Vec<LintId>, bool)>,
lint_groups: FxHashMap<&'static str, (Vec<LintId>, bool)>,
/// Extra info for future incompatibility lints, descibing the
/// issue or RFC that caused the incompatibility.
future_incompatible: FnvHashMap<LintId, FutureIncompatibleInfo>,
future_incompatible: FxHashMap<LintId, FutureIncompatibleInfo>,
/// Maximum level a lint can be
lint_cap: Option<Level>,
@ -171,10 +171,10 @@ impl LintStore {
lints: vec![],
early_passes: Some(vec![]),
late_passes: Some(vec![]),
by_name: FnvHashMap(),
levels: FnvHashMap(),
future_incompatible: FnvHashMap(),
lint_groups: FnvHashMap(),
by_name: FxHashMap(),
levels: FxHashMap(),
future_incompatible: FxHashMap(),
lint_groups: FxHashMap(),
lint_cap: None,
}
}
@ -304,8 +304,8 @@ impl LintStore {
Err(FindLintError::Removed) => { }
Err(_) => {
match self.lint_groups.iter().map(|(&x, pair)| (x, pair.0.clone()))
.collect::<FnvHashMap<&'static str,
Vec<LintId>>>()
.collect::<FxHashMap<&'static str,
Vec<LintId>>>()
.get(&lint_name[..]) {
Some(v) => {
v.iter()

View file

@ -22,7 +22,7 @@ use ty::{self, TyCtxt};
use hir::def::Def;
use hir::def_id::{DefId};
use lint;
use util::nodemap::FnvHashSet;
use util::nodemap::FxHashSet;
use syntax::{ast, codemap};
use syntax::attr;
@ -48,7 +48,7 @@ fn should_explore<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
struct MarkSymbolVisitor<'a, 'tcx: 'a> {
worklist: Vec<ast::NodeId>,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
live_symbols: Box<FnvHashSet<ast::NodeId>>,
live_symbols: Box<FxHashSet<ast::NodeId>>,
struct_has_extern_repr: bool,
ignore_non_const_paths: bool,
inherited_pub_visibility: bool,
@ -61,7 +61,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
MarkSymbolVisitor {
worklist: worklist,
tcx: tcx,
live_symbols: box FnvHashSet(),
live_symbols: box FxHashSet(),
struct_has_extern_repr: false,
ignore_non_const_paths: false,
inherited_pub_visibility: false,
@ -163,7 +163,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
}
fn mark_live_symbols(&mut self) {
let mut scanned = FnvHashSet();
let mut scanned = FxHashSet();
while !self.worklist.is_empty() {
let id = self.worklist.pop().unwrap();
if scanned.contains(&id) {
@ -396,7 +396,7 @@ fn create_and_seed_worklist<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
access_levels: &privacy::AccessLevels,
krate: &hir::Crate)
-> Box<FnvHashSet<ast::NodeId>> {
-> Box<FxHashSet<ast::NodeId>> {
let worklist = create_and_seed_worklist(tcx, access_levels, krate);
let mut symbol_visitor = MarkSymbolVisitor::new(tcx, worklist);
symbol_visitor.mark_live_symbols();
@ -414,7 +414,7 @@ fn get_struct_ctor_id(item: &hir::Item) -> Option<ast::NodeId> {
struct DeadVisitor<'a, 'tcx: 'a> {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
live_symbols: Box<FnvHashSet<ast::NodeId>>,
live_symbols: Box<FxHashSet<ast::NodeId>>,
}
impl<'a, 'tcx> DeadVisitor<'a, 'tcx> {

View file

@ -66,7 +66,7 @@ use hir::def_id::CrateNum;
use session;
use session::config;
use middle::cstore::LinkagePreference::{self, RequireStatic, RequireDynamic};
use util::nodemap::FnvHashMap;
use util::nodemap::FxHashMap;
use rustc_back::PanicStrategy;
/// A list of dependencies for a certain crate type.
@ -80,7 +80,7 @@ pub type DependencyList = Vec<Linkage>;
/// A mapping of all required dependencies for a particular flavor of output.
///
/// This is local to the tcx, and is generally relevant to one session.
pub type Dependencies = FnvHashMap<config::CrateType, DependencyList>;
pub type Dependencies = FxHashMap<config::CrateType, DependencyList>;
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum Linkage {
@ -149,7 +149,7 @@ fn calculate_type(sess: &session::Session,
config::CrateTypeProcMacro => {},
}
let mut formats = FnvHashMap();
let mut formats = FxHashMap();
// Sweep all crates for found dylibs. Add all dylibs, as well as their
// dependencies, ensuring there are no conflicts. The only valid case for a
@ -240,7 +240,7 @@ fn calculate_type(sess: &session::Session,
fn add_library(sess: &session::Session,
cnum: CrateNum,
link: LinkagePreference,
m: &mut FnvHashMap<CrateNum, LinkagePreference>) {
m: &mut FxHashMap<CrateNum, LinkagePreference>) {
match m.get(&cnum) {
Some(&link2) => {
// If the linkages differ, then we'd have two copies of the library

View file

@ -27,7 +27,7 @@ use session::Session;
use hir::def_id::DefId;
use ty;
use middle::weak_lang_items;
use util::nodemap::FnvHashMap;
use util::nodemap::FxHashMap;
use syntax::ast;
use syntax::parse::token::InternedString;
@ -146,7 +146,7 @@ struct LanguageItemCollector<'a, 'tcx: 'a> {
session: &'a Session,
item_refs: FnvHashMap<&'static str, usize>,
item_refs: FxHashMap<&'static str, usize>,
}
impl<'a, 'v, 'tcx> Visitor<'v> for LanguageItemCollector<'a, 'tcx> {
@ -169,7 +169,7 @@ impl<'a, 'v, 'tcx> Visitor<'v> for LanguageItemCollector<'a, 'tcx> {
impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
pub fn new(session: &'a Session, ast_map: &'a hir_map::Map<'tcx>)
-> LanguageItemCollector<'a, 'tcx> {
let mut item_refs = FnvHashMap();
let mut item_refs = FxHashMap();
$( item_refs.insert($name, $variant as usize); )*

View file

@ -12,7 +12,7 @@
//! outside their scopes. This pass will also generate a set of exported items
//! which are available for use externally when compiled as a library.
use util::nodemap::{DefIdSet, FnvHashMap};
use util::nodemap::{DefIdSet, FxHashMap};
use std::hash::Hash;
use std::fmt;
@ -35,7 +35,7 @@ pub enum AccessLevel {
// Accessibility levels for reachable HIR nodes
#[derive(Clone)]
pub struct AccessLevels<Id = NodeId> {
pub map: FnvHashMap<Id, AccessLevel>
pub map: FxHashMap<Id, AccessLevel>
}
impl<Id: Hash + Eq> AccessLevels<Id> {

View file

@ -22,7 +22,7 @@ use hir::def_id::DefId;
use ty::{self, TyCtxt};
use middle::privacy;
use session::config;
use util::nodemap::{NodeSet, FnvHashSet};
use util::nodemap::{NodeSet, FxHashSet};
use syntax::abi::Abi;
use syntax::ast;
@ -204,7 +204,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
// Step 2: Mark all symbols that the symbols on the worklist touch.
fn propagate(&mut self) {
let mut scanned = FnvHashSet();
let mut scanned = FxHashSet();
loop {
let search_item = match self.worklist.pop() {
Some(item) => item,

View file

@ -19,7 +19,7 @@
use dep_graph::DepNode;
use hir::map as ast_map;
use session::Session;
use util::nodemap::{FnvHashMap, NodeMap, NodeSet};
use util::nodemap::{FxHashMap, NodeMap, NodeSet};
use ty;
use std::cell::RefCell;
@ -251,7 +251,7 @@ impl CodeExtent {
/// The region maps encode information about region relationships.
pub struct RegionMaps {
code_extents: RefCell<Vec<CodeExtentData>>,
code_extent_interner: RefCell<FnvHashMap<CodeExtentData, CodeExtent>>,
code_extent_interner: RefCell<FxHashMap<CodeExtentData, CodeExtent>>,
/// `scope_map` maps from a scope id to the enclosing scope id;
/// this is usually corresponding to the lexical nesting, though
/// in the case of closures the parent scope is the innermost
@ -1217,7 +1217,7 @@ pub fn resolve_crate(sess: &Session, map: &ast_map::Map) -> RegionMaps {
let maps = RegionMaps {
code_extents: RefCell::new(vec![]),
code_extent_interner: RefCell::new(FnvHashMap()),
code_extent_interner: RefCell::new(FxHashMap()),
scope_map: RefCell::new(vec![]),
var_map: RefCell::new(NodeMap()),
rvalue_scopes: RefCell::new(NodeMap()),

View file

@ -31,7 +31,7 @@ use syntax::parse::token::keywords;
use syntax_pos::Span;
use util::nodemap::NodeMap;
use rustc_data_structures::fnv::FnvHashSet;
use rustc_data_structures::fx::FxHashSet;
use hir;
use hir::print::lifetime_to_string;
use hir::intravisit::{self, Visitor, FnKind};
@ -847,13 +847,13 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
generics: &hir::Generics) {
debug!("insert_late_bound_lifetimes(decl={:?}, generics={:?})", decl, generics);
let mut constrained_by_input = ConstrainedCollector { regions: FnvHashSet() };
let mut constrained_by_input = ConstrainedCollector { regions: FxHashSet() };
for arg in &decl.inputs {
constrained_by_input.visit_ty(&arg.ty);
}
let mut appears_in_output = AllCollector {
regions: FnvHashSet(),
regions: FxHashSet(),
impl_trait: false
};
intravisit::walk_fn_ret_ty(&mut appears_in_output, &decl.output);
@ -866,7 +866,7 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
// Subtle point: because we disallow nested bindings, we can just
// ignore binders here and scrape up all names we see.
let mut appears_in_where_clause = AllCollector {
regions: FnvHashSet(),
regions: FxHashSet(),
impl_trait: false
};
for ty_param in generics.ty_params.iter() {
@ -926,7 +926,7 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
return;
struct ConstrainedCollector {
regions: FnvHashSet<ast::Name>,
regions: FxHashSet<ast::Name>,
}
impl<'v> Visitor<'v> for ConstrainedCollector {
@ -961,7 +961,7 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
}
struct AllCollector {
regions: FnvHashSet<ast::Name>,
regions: FxHashSet<ast::Name>,
impl_trait: bool
}

View file

@ -27,7 +27,7 @@ use syntax::ast;
use syntax::ast::{NodeId, Attribute};
use syntax::feature_gate::{GateIssue, emit_feature_err, find_lang_feature_accepted_version};
use syntax::attr::{self, Stability, Deprecation};
use util::nodemap::{DefIdMap, FnvHashSet, FnvHashMap};
use util::nodemap::{DefIdMap, FxHashSet, FxHashMap};
use hir;
use hir::{Item, Generics, StructField, Variant, PatKind};
@ -102,7 +102,7 @@ pub struct Index<'tcx> {
depr_map: DefIdMap<Option<DeprecationEntry>>,
/// Maps for each crate whether it is part of the staged API.
staged_api: FnvHashMap<CrateNum, bool>
staged_api: FxHashMap<CrateNum, bool>
}
// A private tree-walker for producing an Index.
@ -343,7 +343,7 @@ impl<'a, 'tcx> Index<'tcx> {
}
}
let mut staged_api = FnvHashMap();
let mut staged_api = FxHashMap();
staged_api.insert(LOCAL_CRATE, is_staged_api);
Index {
staged_api: staged_api,
@ -357,7 +357,7 @@ impl<'a, 'tcx> Index<'tcx> {
/// features and possibly prints errors. Returns a list of all
/// features used.
pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
-> FnvHashMap<InternedString, attr::StabilityLevel> {
-> FxHashMap<InternedString, attr::StabilityLevel> {
let _task = tcx.dep_graph.in_task(DepNode::StabilityCheck);
let ref active_lib_features = tcx.sess.features.borrow().declared_lib_features;
@ -367,7 +367,7 @@ pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
let mut checker = Checker {
tcx: tcx,
active_features: active_features,
used_features: FnvHashMap(),
used_features: FxHashMap(),
in_skip_block: 0,
};
intravisit::walk_crate(&mut checker, tcx.map.krate());
@ -377,8 +377,8 @@ pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
struct Checker<'a, 'tcx: 'a> {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
active_features: FnvHashSet<InternedString>,
used_features: FnvHashMap<InternedString, attr::StabilityLevel>,
active_features: FxHashSet<InternedString>,
used_features: FxHashMap<InternedString, attr::StabilityLevel>,
// Within a block where feature gate checking can be skipped.
in_skip_block: u32,
}
@ -746,10 +746,10 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
/// were expected to be library features), and the list of features used from
/// libraries, identify activated features that don't exist and error about them.
pub fn check_unused_or_stable_features(sess: &Session,
lib_features_used: &FnvHashMap<InternedString,
attr::StabilityLevel>) {
lib_features_used: &FxHashMap<InternedString,
attr::StabilityLevel>) {
let ref declared_lib_features = sess.features.borrow().declared_lib_features;
let mut remaining_lib_features: FnvHashMap<InternedString, Span>
let mut remaining_lib_features: FxHashMap<InternedString, Span>
= declared_lib_features.clone().into_iter().collect();
fn format_stable_since_msg(version: &str) -> String {

View file

@ -17,7 +17,7 @@ use middle::dependency_format;
use session::search_paths::PathKind;
use session::config::DebugInfoLevel;
use ty::tls;
use util::nodemap::{NodeMap, FnvHashMap, FnvHashSet};
use util::nodemap::{NodeMap, FxHashMap, FxHashSet};
use util::common::duration_to_secs_str;
use mir::transform as mir_pass;
@ -78,7 +78,7 @@ pub struct Session {
/// Set of (LintId, span, message) tuples tracking lint (sub)diagnostics
/// that have been set once, but should not be set again, in order to avoid
/// redundantly verbose output (Issue #24690).
pub one_time_diagnostics: RefCell<FnvHashSet<(lint::LintId, Span, String)>>,
pub one_time_diagnostics: RefCell<FxHashSet<(lint::LintId, Span, String)>>,
pub plugin_llvm_passes: RefCell<Vec<String>>,
pub mir_passes: RefCell<mir_pass::Passes>,
pub plugin_attributes: RefCell<Vec<(String, AttributeType)>>,
@ -603,12 +603,12 @@ pub fn build_session_(sopts: config::Options,
working_dir: env::current_dir().unwrap(),
lint_store: RefCell::new(lint::LintStore::new()),
lints: RefCell::new(NodeMap()),
one_time_diagnostics: RefCell::new(FnvHashSet()),
one_time_diagnostics: RefCell::new(FxHashSet()),
plugin_llvm_passes: RefCell::new(Vec::new()),
mir_passes: RefCell::new(mir_pass::Passes::new()),
plugin_attributes: RefCell::new(Vec::new()),
crate_types: RefCell::new(Vec::new()),
dependency_formats: RefCell::new(FnvHashMap()),
dependency_formats: RefCell::new(FxHashMap()),
crate_disambiguator: RefCell::new(token::intern("").as_str()),
features: RefCell::new(feature_gate::Features::new()),
recursion_limit: Cell::new(64),

View file

@ -33,7 +33,7 @@ use ty::error::ExpectedFound;
use ty::fast_reject;
use ty::fold::TypeFolder;
use ty::subst::Subst;
use util::nodemap::{FnvHashMap, FnvHashSet};
use util::nodemap::{FxHashMap, FxHashSet};
use std::cmp;
use std::fmt;
@ -252,7 +252,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let generic_map = def.generics.types.iter().map(|param| {
(param.name.as_str().to_string(),
trait_ref.substs.type_for_def(param).to_string())
}).collect::<FnvHashMap<String, String>>();
}).collect::<FxHashMap<String, String>>();
let parser = Parser::new(&istring);
let mut errored = false;
let err: String = parser.filter_map(|p| {
@ -647,7 +647,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
"the trait `{}` cannot be made into an object", trait_str
));
let mut reported_violations = FnvHashSet();
let mut reported_violations = FxHashSet();
for violation in violations {
if !reported_violations.insert(violation.clone()) {
continue;
@ -786,7 +786,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
fn predicate_can_apply(&self, pred: ty::PolyTraitRef<'tcx>) -> bool {
struct ParamToVarFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
var_map: FnvHashMap<Ty<'tcx>, Ty<'tcx>>
var_map: FxHashMap<Ty<'tcx>, Ty<'tcx>>
}
impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ParamToVarFolder<'a, 'gcx, 'tcx> {
@ -807,7 +807,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let cleaned_pred = pred.fold_with(&mut ParamToVarFolder {
infcx: self,
var_map: FnvHashMap()
var_map: FxHashMap()
});
let cleaned_pred = super::project::normalize(

View file

@ -18,7 +18,7 @@ use std::marker::PhantomData;
use std::mem;
use syntax::ast;
use util::common::ErrorReported;
use util::nodemap::{FnvHashSet, NodeMap};
use util::nodemap::{FxHashSet, NodeMap};
use super::CodeAmbiguity;
use super::CodeProjectionError;
@ -37,7 +37,7 @@ impl<'tcx> ForestObligation for PendingPredicateObligation<'tcx> {
}
pub struct GlobalFulfilledPredicates<'tcx> {
set: FnvHashSet<ty::PolyTraitPredicate<'tcx>>,
set: FxHashSet<ty::PolyTraitPredicate<'tcx>>,
dep_graph: DepGraph,
}
@ -673,7 +673,7 @@ fn register_region_obligation<'tcx>(t_a: Ty<'tcx>,
impl<'a, 'gcx, 'tcx> GlobalFulfilledPredicates<'gcx> {
pub fn new(dep_graph: DepGraph) -> GlobalFulfilledPredicates<'gcx> {
GlobalFulfilledPredicates {
set: FnvHashSet(),
set: FxHashSet(),
dep_graph: dep_graph,
}
}

View file

@ -51,7 +51,7 @@ use std::mem;
use std::rc::Rc;
use syntax::abi::Abi;
use hir;
use util::nodemap::FnvHashMap;
use util::nodemap::FxHashMap;
struct InferredObligationsSnapshotVecDelegate<'tcx> {
phantom: PhantomData<&'tcx i32>,
@ -104,8 +104,8 @@ struct TraitObligationStack<'prev, 'tcx: 'prev> {
#[derive(Clone)]
pub struct SelectionCache<'tcx> {
hashmap: RefCell<FnvHashMap<ty::TraitRef<'tcx>,
SelectionResult<'tcx, SelectionCandidate<'tcx>>>>,
hashmap: RefCell<FxHashMap<ty::TraitRef<'tcx>,
SelectionResult<'tcx, SelectionCandidate<'tcx>>>>,
}
pub enum MethodMatchResult {
@ -306,7 +306,7 @@ enum EvaluationResult {
#[derive(Clone)]
pub struct EvaluationCache<'tcx> {
hashmap: RefCell<FnvHashMap<ty::PolyTraitRef<'tcx>, EvaluationResult>>
hashmap: RefCell<FxHashMap<ty::PolyTraitRef<'tcx>, EvaluationResult>>
}
impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
@ -2937,7 +2937,7 @@ impl<'tcx> TraitObligation<'tcx> {
impl<'tcx> SelectionCache<'tcx> {
pub fn new() -> SelectionCache<'tcx> {
SelectionCache {
hashmap: RefCell::new(FnvHashMap())
hashmap: RefCell::new(FxHashMap())
}
}
}
@ -2945,7 +2945,7 @@ impl<'tcx> SelectionCache<'tcx> {
impl<'tcx> EvaluationCache<'tcx> {
pub fn new() -> EvaluationCache<'tcx> {
EvaluationCache {
hashmap: RefCell::new(FnvHashMap())
hashmap: RefCell::new(FxHashMap())
}
}
}

View file

@ -20,7 +20,7 @@
use super::{SelectionContext, FulfillmentContext};
use super::util::impl_trait_ref_and_oblig;
use rustc_data_structures::fnv::FnvHashMap;
use rustc_data_structures::fx::FxHashMap;
use hir::def_id::DefId;
use infer::{InferCtxt, InferOk, TypeOrigin};
use middle::region;
@ -270,13 +270,13 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
}
pub struct SpecializesCache {
map: FnvHashMap<(DefId, DefId), bool>
map: FxHashMap<(DefId, DefId), bool>
}
impl SpecializesCache {
pub fn new() -> Self {
SpecializesCache {
map: FnvHashMap()
map: FxHashMap()
}
}

View file

@ -17,7 +17,7 @@ use traits::{self, Reveal};
use ty::{self, TyCtxt, ImplOrTraitItem, TraitDef, TypeFoldable};
use ty::fast_reject::{self, SimplifiedType};
use syntax::ast::Name;
use util::nodemap::{DefIdMap, FnvHashMap};
use util::nodemap::{DefIdMap, FxHashMap};
/// A per-trait graph of impls in specialization order. At the moment, this
/// graph forms a tree rooted with the trait itself, with all other nodes
@ -57,7 +57,7 @@ struct Children {
// the specialization graph.
/// Impls of the trait.
nonblanket_impls: FnvHashMap<fast_reject::SimplifiedType, Vec<DefId>>,
nonblanket_impls: FxHashMap<fast_reject::SimplifiedType, Vec<DefId>>,
/// Blanket impls associated with the trait.
blanket_impls: Vec<DefId>,
@ -78,7 +78,7 @@ enum Inserted {
impl<'a, 'gcx, 'tcx> Children {
fn new() -> Children {
Children {
nonblanket_impls: FnvHashMap(),
nonblanket_impls: FxHashMap(),
blanket_impls: vec![],
}
}

View file

@ -13,7 +13,7 @@ use ty::subst::{Subst, Substs};
use ty::{self, Ty, TyCtxt, ToPredicate, ToPolyTraitRef};
use ty::outlives::Component;
use util::common::ErrorReported;
use util::nodemap::FnvHashSet;
use util::nodemap::FxHashSet;
use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext, Normalized};
@ -50,12 +50,12 @@ fn anonymize_predicate<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
struct PredicateSet<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
tcx: TyCtxt<'a, 'gcx, 'tcx>,
set: FnvHashSet<ty::Predicate<'tcx>>,
set: FxHashSet<ty::Predicate<'tcx>>,
}
impl<'a, 'gcx, 'tcx> PredicateSet<'a, 'gcx, 'tcx> {
fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> PredicateSet<'a, 'gcx, 'tcx> {
PredicateSet { tcx: tcx, set: FnvHashSet() }
PredicateSet { tcx: tcx, set: FxHashSet() }
}
fn insert(&mut self, pred: &ty::Predicate<'tcx>) -> bool {
@ -272,7 +272,7 @@ pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>,
pub struct SupertraitDefIds<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
tcx: TyCtxt<'a, 'gcx, 'tcx>,
stack: Vec<DefId>,
visited: FnvHashSet<DefId>,
visited: FxHashSet<DefId>,
}
pub fn supertrait_def_ids<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>,

View file

@ -11,7 +11,7 @@
use hir::def_id::{DefId};
use ty::{self, Ty, TyCtxt};
use util::common::MemoizationMap;
use util::nodemap::FnvHashMap;
use util::nodemap::FxHashMap;
use std::fmt;
use std::ops;
@ -141,11 +141,11 @@ impl fmt::Debug for TypeContents {
impl<'a, 'tcx> ty::TyS<'tcx> {
pub fn type_contents(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> TypeContents {
return tcx.tc_cache.memoize(self, || tc_ty(tcx, self, &mut FnvHashMap()));
return tcx.tc_cache.memoize(self, || tc_ty(tcx, self, &mut FxHashMap()));
fn tc_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
ty: Ty<'tcx>,
cache: &mut FnvHashMap<Ty<'tcx>, TypeContents>) -> TypeContents
cache: &mut FxHashMap<Ty<'tcx>, TypeContents>) -> TypeContents
{
// Subtle: Note that we are *not* using tcx.tc_cache here but rather a
// private cache for this walk. This is needed in the case of cyclic

View file

@ -36,7 +36,7 @@ use ty::layout::{Layout, TargetDataLayout};
use ty::maps;
use util::common::MemoizationMap;
use util::nodemap::{NodeMap, NodeSet, DefIdMap, DefIdSet};
use util::nodemap::{FnvHashMap, FnvHashSet};
use util::nodemap::{FxHashMap, FxHashSet};
use rustc_data_structures::accumulate_vec::AccumulateVec;
use arena::TypedArena;
@ -96,26 +96,26 @@ pub struct CtxtInterners<'tcx> {
/// Specifically use a speedy hash algorithm for these hash sets,
/// they're accessed quite often.
type_: RefCell<FnvHashSet<Interned<'tcx, TyS<'tcx>>>>,
type_list: RefCell<FnvHashSet<Interned<'tcx, Slice<Ty<'tcx>>>>>,
substs: RefCell<FnvHashSet<Interned<'tcx, Substs<'tcx>>>>,
bare_fn: RefCell<FnvHashSet<Interned<'tcx, BareFnTy<'tcx>>>>,
region: RefCell<FnvHashSet<Interned<'tcx, Region>>>,
stability: RefCell<FnvHashSet<&'tcx attr::Stability>>,
layout: RefCell<FnvHashSet<&'tcx Layout>>,
type_: RefCell<FxHashSet<Interned<'tcx, TyS<'tcx>>>>,
type_list: RefCell<FxHashSet<Interned<'tcx, Slice<Ty<'tcx>>>>>,
substs: RefCell<FxHashSet<Interned<'tcx, Substs<'tcx>>>>,
bare_fn: RefCell<FxHashSet<Interned<'tcx, BareFnTy<'tcx>>>>,
region: RefCell<FxHashSet<Interned<'tcx, Region>>>,
stability: RefCell<FxHashSet<&'tcx attr::Stability>>,
layout: RefCell<FxHashSet<&'tcx Layout>>,
}
impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
fn new(arenas: &'tcx CtxtArenas<'tcx>) -> CtxtInterners<'tcx> {
CtxtInterners {
arenas: arenas,
type_: RefCell::new(FnvHashSet()),
type_list: RefCell::new(FnvHashSet()),
substs: RefCell::new(FnvHashSet()),
bare_fn: RefCell::new(FnvHashSet()),
region: RefCell::new(FnvHashSet()),
stability: RefCell::new(FnvHashSet()),
layout: RefCell::new(FnvHashSet())
type_: RefCell::new(FxHashSet()),
type_list: RefCell::new(FxHashSet()),
substs: RefCell::new(FxHashSet()),
bare_fn: RefCell::new(FxHashSet()),
region: RefCell::new(FxHashSet()),
stability: RefCell::new(FxHashSet()),
layout: RefCell::new(FxHashSet())
}
}
@ -244,11 +244,11 @@ pub struct Tables<'tcx> {
impl<'a, 'gcx, 'tcx> Tables<'tcx> {
pub fn empty() -> Tables<'tcx> {
Tables {
node_types: FnvHashMap(),
node_types: FxHashMap(),
item_substs: NodeMap(),
adjustments: NodeMap(),
method_map: FnvHashMap(),
upvar_capture_map: FnvHashMap(),
method_map: FxHashMap(),
upvar_capture_map: FxHashMap(),
closure_tys: DefIdMap(),
closure_kinds: DefIdMap(),
liberated_fn_sigs: NodeMap(),
@ -451,16 +451,16 @@ pub struct GlobalCtxt<'tcx> {
pub tcache: RefCell<DepTrackingMap<maps::Tcache<'tcx>>>,
// Internal cache for metadata decoding. No need to track deps on this.
pub rcache: RefCell<FnvHashMap<ty::CReaderCacheKey, Ty<'tcx>>>,
pub rcache: RefCell<FxHashMap<ty::CReaderCacheKey, Ty<'tcx>>>,
// Cache for the type-contents routine. FIXME -- track deps?
pub tc_cache: RefCell<FnvHashMap<Ty<'tcx>, ty::contents::TypeContents>>,
pub tc_cache: RefCell<FxHashMap<Ty<'tcx>, ty::contents::TypeContents>>,
// FIXME no dep tracking, but we should be able to remove this
pub ty_param_defs: RefCell<NodeMap<ty::TypeParameterDef<'tcx>>>,
// FIXME dep tracking -- should be harmless enough
pub normalized_cache: RefCell<FnvHashMap<Ty<'tcx>, Ty<'tcx>>>,
pub normalized_cache: RefCell<FxHashMap<Ty<'tcx>, Ty<'tcx>>>,
pub lang_items: middle::lang_items::LanguageItems,
@ -571,7 +571,7 @@ pub struct GlobalCtxt<'tcx> {
pub data_layout: TargetDataLayout,
/// Cache for layouts computed from types.
pub layout_cache: RefCell<FnvHashMap<Ty<'tcx>, &'tcx Layout>>,
pub layout_cache: RefCell<FxHashMap<Ty<'tcx>, &'tcx Layout>>,
/// Used to prevent layout from recursing too deeply.
pub layout_depth: Cell<usize>,
@ -801,7 +801,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
types: common_types,
named_region_map: named_region_map,
region_maps: region_maps,
free_region_maps: RefCell::new(FnvHashMap()),
free_region_maps: RefCell::new(FxHashMap()),
item_variance_map: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
variance_computed: Cell::new(false),
sess: s,
@ -820,13 +820,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
freevars: RefCell::new(freevars),
maybe_unused_trait_imports: maybe_unused_trait_imports,
tcache: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
rcache: RefCell::new(FnvHashMap()),
tc_cache: RefCell::new(FnvHashMap()),
rcache: RefCell::new(FxHashMap()),
tc_cache: RefCell::new(FxHashMap()),
impl_or_trait_items: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
impl_or_trait_item_def_ids: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
trait_items_cache: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
ty_param_defs: RefCell::new(NodeMap()),
normalized_cache: RefCell::new(FnvHashMap()),
normalized_cache: RefCell::new(FxHashMap()),
lang_items: lang_items,
inherent_impls: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
used_unsafe: RefCell::new(NodeSet()),
@ -846,7 +846,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
fragment_infos: RefCell::new(DefIdMap()),
crate_name: token::intern_and_get_ident(crate_name),
data_layout: data_layout,
layout_cache: RefCell::new(FnvHashMap()),
layout_cache: RefCell::new(FxHashMap()),
layout_depth: Cell::new(0),
derive_macros: RefCell::new(NodeMap()),
}, f)

View file

@ -45,7 +45,7 @@ use ty::adjustment;
use ty::{self, Binder, Ty, TyCtxt, TypeFlags};
use std::fmt;
use util::nodemap::{FnvHashMap, FnvHashSet};
use util::nodemap::{FxHashMap, FxHashSet};
/// The TypeFoldable trait is implemented for every type that can be folded.
/// Basically, every type that has a corresponding method in TypeFolder.
@ -225,7 +225,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
/// whether any late-bound regions were skipped
pub fn collect_regions<T>(self,
value: &T,
region_set: &mut FnvHashSet<&'tcx ty::Region>)
region_set: &mut FxHashSet<&'tcx ty::Region>)
-> bool
where T : TypeFoldable<'tcx>
{
@ -319,14 +319,14 @@ struct RegionReplacer<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
tcx: TyCtxt<'a, 'gcx, 'tcx>,
current_depth: u32,
fld_r: &'a mut (FnMut(ty::BoundRegion) -> &'tcx ty::Region + 'a),
map: FnvHashMap<ty::BoundRegion, &'tcx ty::Region>
map: FxHashMap<ty::BoundRegion, &'tcx ty::Region>
}
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn replace_late_bound_regions<T,F>(self,
value: &Binder<T>,
mut f: F)
-> (T, FnvHashMap<ty::BoundRegion, &'tcx ty::Region>)
-> (T, FxHashMap<ty::BoundRegion, &'tcx ty::Region>)
where F : FnMut(ty::BoundRegion) -> &'tcx ty::Region,
T : TypeFoldable<'tcx>,
{
@ -390,7 +390,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
/// variables and equate `value` with something else, those
/// variables will also be equated.
pub fn collect_constrained_late_bound_regions<T>(&self, value: &Binder<T>)
-> FnvHashSet<ty::BoundRegion>
-> FxHashSet<ty::BoundRegion>
where T : TypeFoldable<'tcx>
{
self.collect_late_bound_regions(value, true)
@ -398,14 +398,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
/// Returns a set of all late-bound regions that appear in `value` anywhere.
pub fn collect_referenced_late_bound_regions<T>(&self, value: &Binder<T>)
-> FnvHashSet<ty::BoundRegion>
-> FxHashSet<ty::BoundRegion>
where T : TypeFoldable<'tcx>
{
self.collect_late_bound_regions(value, false)
}
fn collect_late_bound_regions<T>(&self, value: &Binder<T>, just_constraint: bool)
-> FnvHashSet<ty::BoundRegion>
-> FxHashSet<ty::BoundRegion>
where T : TypeFoldable<'tcx>
{
let mut collector = LateBoundRegionsCollector::new(just_constraint);
@ -450,7 +450,7 @@ impl<'a, 'gcx, 'tcx> RegionReplacer<'a, 'gcx, 'tcx> {
tcx: tcx,
current_depth: 1,
fld_r: fld_r,
map: FnvHashMap()
map: FxHashMap()
}
}
}
@ -650,7 +650,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
/// Collects all the late-bound regions it finds into a hash set.
struct LateBoundRegionsCollector {
current_depth: u32,
regions: FnvHashSet<ty::BoundRegion>,
regions: FxHashSet<ty::BoundRegion>,
just_constrained: bool,
}
@ -658,7 +658,7 @@ impl LateBoundRegionsCollector {
fn new(just_constrained: bool) -> Self {
LateBoundRegionsCollector {
current_depth: 1,
regions: FnvHashSet(),
regions: FxHashSet(),
just_constrained: just_constrained,
}
}

View file

@ -31,7 +31,7 @@ use ty::subst::{Subst, Substs};
use ty::walk::TypeWalker;
use util::common::MemoizationMap;
use util::nodemap::NodeSet;
use util::nodemap::FnvHashMap;
use util::nodemap::FxHashMap;
use serialize::{self, Encodable, Encoder};
use std::borrow::Cow;
@ -418,7 +418,7 @@ impl MethodCall {
// maps from an expression id that corresponds to a method call to the details
// of the method to be invoked
pub type MethodMap<'tcx> = FnvHashMap<MethodCall, MethodCallee<'tcx>>;
pub type MethodMap<'tcx> = FxHashMap<MethodCall, MethodCallee<'tcx>>;
// Contains information needed to resolve types and (in the future) look up
// the types of AST nodes.
@ -650,7 +650,7 @@ pub struct UpvarBorrow<'tcx> {
pub region: &'tcx ty::Region,
}
pub type UpvarCaptureMap<'tcx> = FnvHashMap<UpvarId, UpvarCapture<'tcx>>;
pub type UpvarCaptureMap<'tcx> = FxHashMap<UpvarId, UpvarCapture<'tcx>>;
#[derive(Copy, Clone)]
pub struct ClosureUpvar<'tcx> {
@ -1251,10 +1251,10 @@ pub struct ParameterEnvironment<'tcx> {
pub free_id_outlive: CodeExtent,
/// A cache for `moves_by_default`.
pub is_copy_cache: RefCell<FnvHashMap<Ty<'tcx>, bool>>,
pub is_copy_cache: RefCell<FxHashMap<Ty<'tcx>, bool>>,
/// A cache for `type_is_sized`
pub is_sized_cache: RefCell<FnvHashMap<Ty<'tcx>, bool>>,
pub is_sized_cache: RefCell<FxHashMap<Ty<'tcx>, bool>>,
}
impl<'a, 'tcx> ParameterEnvironment<'tcx> {
@ -1267,8 +1267,8 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
implicit_region_bound: self.implicit_region_bound,
caller_bounds: caller_bounds,
free_id_outlive: self.free_id_outlive,
is_copy_cache: RefCell::new(FnvHashMap()),
is_sized_cache: RefCell::new(FnvHashMap()),
is_copy_cache: RefCell::new(FxHashMap()),
is_sized_cache: RefCell::new(FxHashMap()),
}
}
@ -2752,8 +2752,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
caller_bounds: Vec::new(),
implicit_region_bound: self.mk_region(ty::ReEmpty),
free_id_outlive: free_id_outlive,
is_copy_cache: RefCell::new(FnvHashMap()),
is_sized_cache: RefCell::new(FnvHashMap()),
is_copy_cache: RefCell::new(FxHashMap()),
is_sized_cache: RefCell::new(FxHashMap()),
}
}
@ -2824,8 +2824,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
implicit_region_bound: tcx.mk_region(ty::ReScope(free_id_outlive)),
caller_bounds: predicates,
free_id_outlive: free_id_outlive,
is_copy_cache: RefCell::new(FnvHashMap()),
is_sized_cache: RefCell::new(FnvHashMap()),
is_copy_cache: RefCell::new(FxHashMap()),
is_sized_cache: RefCell::new(FxHashMap()),
};
let cause = traits::ObligationCause::misc(span, free_id_outlive.node_id(&self.region_maps));

View file

@ -16,7 +16,7 @@ use ty::fast_reject;
use ty::{Ty, TyCtxt, TraitRef};
use std::cell::{Cell, RefCell};
use hir;
use util::nodemap::FnvHashMap;
use util::nodemap::FxHashMap;
/// As `TypeScheme` but for a trait ref.
pub struct TraitDef<'tcx> {
@ -55,7 +55,7 @@ pub struct TraitDef<'tcx> {
/// Impls of the trait.
nonblanket_impls: RefCell<
FnvHashMap<fast_reject::SimplifiedType, Vec<DefId>>
FxHashMap<fast_reject::SimplifiedType, Vec<DefId>>
>,
/// Blanket impls associated with the trait.
@ -84,7 +84,7 @@ impl<'a, 'gcx, 'tcx> TraitDef<'tcx> {
unsafety: unsafety,
generics: generics,
trait_ref: trait_ref,
nonblanket_impls: RefCell::new(FnvHashMap()),
nonblanket_impls: RefCell::new(FxHashMap()),
blanket_impls: RefCell::new(vec![]),
flags: Cell::new(ty::TraitFlags::NO_TRAIT_FLAGS),
specialization_graph: RefCell::new(traits::specialization_graph::Graph::new()),

View file

@ -20,7 +20,7 @@ use ty::{Disr, ParameterEnvironment};
use ty::fold::TypeVisitor;
use ty::layout::{Layout, LayoutError};
use ty::TypeVariants::*;
use util::nodemap::FnvHashMap;
use util::nodemap::FxHashMap;
use rustc_const_math::{ConstInt, ConstIsize, ConstUsize};
@ -594,7 +594,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> {
fn impls_bound(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
param_env: &ParameterEnvironment<'tcx>,
bound: ty::BuiltinBound,
cache: &RefCell<FnvHashMap<Ty<'tcx>, bool>>,
cache: &RefCell<FxHashMap<Ty<'tcx>, bool>>,
span: Span) -> bool
{
if self.has_param_types() || self.has_self_ty() {

View file

@ -15,17 +15,17 @@
use hir::def_id::DefId;
use syntax::ast;
pub use rustc_data_structures::fnv::FnvHashMap;
pub use rustc_data_structures::fnv::FnvHashSet;
pub use rustc_data_structures::fx::FxHashMap;
pub use rustc_data_structures::fx::FxHashSet;
pub type NodeMap<T> = FnvHashMap<ast::NodeId, T>;
pub type DefIdMap<T> = FnvHashMap<DefId, T>;
pub type NodeMap<T> = FxHashMap<ast::NodeId, T>;
pub type DefIdMap<T> = FxHashMap<DefId, T>;
pub type NodeSet = FnvHashSet<ast::NodeId>;
pub type DefIdSet = FnvHashSet<DefId>;
pub type NodeSet = FxHashSet<ast::NodeId>;
pub type DefIdSet = FxHashSet<DefId>;
pub fn NodeMap<T>() -> NodeMap<T> { FnvHashMap() }
pub fn DefIdMap<T>() -> DefIdMap<T> { FnvHashMap() }
pub fn NodeSet() -> NodeSet { FnvHashSet() }
pub fn DefIdSet() -> DefIdSet { FnvHashSet() }
pub fn NodeMap<T>() -> NodeMap<T> { FxHashMap() }
pub fn DefIdMap<T>() -> DefIdMap<T> { FxHashMap() }
pub fn NodeSet() -> NodeSet { FxHashSet() }
pub fn DefIdSet() -> DefIdSet { FxHashSet() }