Fix typedef/module name conflicts in the compiler

This commit is contained in:
Alex Crichton 2015-01-16 14:27:43 -08:00
parent 2549cbec9d
commit 3121c04043
39 changed files with 180 additions and 204 deletions

View File

@ -575,7 +575,7 @@ pub struct RawPointerDerive {
impl RawPointerDerive {
pub fn new() -> RawPointerDerive {
RawPointerDerive {
checked_raw_pointers: NodeSet::new(),
checked_raw_pointers: NodeSet(),
}
}
}
@ -1323,7 +1323,7 @@ impl UnusedMut {
// collect all mutable pattern and group their NodeIDs by their Identifier to
// avoid false warnings in match arms with multiple patterns
let mut mutables = FnvHashMap::new();
let mut mutables = FnvHashMap();
for p in pats.iter() {
pat_util::pat_bindings(&cx.tcx.def_map, &**p, |mode, id, _, path1| {
let ident = path1.node;

View File

@ -98,9 +98,9 @@ impl LintStore {
LintStore {
lints: vec!(),
passes: Some(vec!()),
by_name: FnvHashMap::new(),
levels: FnvHashMap::new(),
lint_groups: FnvHashMap::new(),
by_name: FnvHashMap(),
levels: FnvHashMap(),
lint_groups: FnvHashMap(),
}
}
@ -468,7 +468,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
exported_items: exported_items,
lints: lint_store,
level_stack: vec![],
node_levels: RefCell::new(FnvHashMap::new()),
node_levels: RefCell::new(FnvHashMap()),
}
}

View File

@ -84,8 +84,8 @@ pub struct CStore {
impl CStore {
pub fn new(intr: Rc<IdentInterner>) -> CStore {
CStore {
metas: RefCell::new(FnvHashMap::new()),
extern_mod_crate_map: RefCell::new(FnvHashMap::new()),
metas: RefCell::new(FnvHashMap()),
extern_mod_crate_map: RefCell::new(FnvHashMap()),
used_crate_sources: RefCell::new(Vec::new()),
used_libraries: RefCell::new(Vec::new()),
used_link_args: RefCell::new(Vec::new()),

View File

@ -2111,7 +2111,7 @@ fn encode_metadata_inner(wr: &mut SeekableMemWriter,
link_meta: link_meta,
cstore: cstore,
encode_inlined_item: RefCell::new(encode_inlined_item),
type_abbrevs: RefCell::new(FnvHashMap::new()),
type_abbrevs: RefCell::new(FnvHashMap()),
reachable: reachable,
};
@ -2216,7 +2216,7 @@ pub fn encoded_ty<'tcx>(tcx: &ty::ctxt<'tcx>, t: Ty<'tcx>) -> String {
diag: tcx.sess.diagnostic(),
ds: def_to_string,
tcx: tcx,
abbrevs: &RefCell::new(FnvHashMap::new())
abbrevs: &RefCell::new(FnvHashMap())
}, t);
String::from_utf8(wr.unwrap()).unwrap()
}

View File

@ -46,7 +46,7 @@ pub fn construct(tcx: &ty::ctxt,
let block_exit;
let mut cfg_builder = CFGBuilder {
exit_map: NodeMap::new(),
exit_map: NodeMap(),
graph: graph,
fn_exit: fn_exit,
tcx: tcx,

View File

@ -64,10 +64,10 @@ struct GlobalChecker {
pub fn check_crate(tcx: &ty::ctxt) {
let mut checker = GlobalChecker {
static_consumptions: NodeSet::new(),
const_borrows: NodeSet::new(),
static_interior_borrows: NodeSet::new(),
static_local_borrows: NodeSet::new(),
static_consumptions: NodeSet(),
const_borrows: NodeSet(),
static_interior_borrows: NodeSet(),
static_local_borrows: NodeSet(),
};
{
let param_env = ty::empty_parameter_environment(tcx);

View File

@ -286,7 +286,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ConstEvalVisitor<'a, 'tcx> {
pub fn process_crate(tcx: &ty::ctxt) {
visit::walk_crate(&mut ConstEvalVisitor {
tcx: tcx,
ccache: DefIdMap::new(),
ccache: DefIdMap(),
}, tcx.map.krate());
tcx.sess.abort_if_errors();
}

View File

@ -145,7 +145,7 @@ impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O
fn build_nodeid_to_index(decl: Option<&ast::FnDecl>,
cfg: &cfg::CFG) -> NodeMap<CFGIndex> {
let mut index = NodeMap::new();
let mut index = NodeMap();
// FIXME (#6298): Would it be better to fold formals from decl
// into cfg itself? i.e. introduce a fn-based flow-graph in

View File

@ -137,7 +137,7 @@ fn calculate_type(sess: &session::Session,
config::CrateTypeExecutable | config::CrateTypeDylib => {},
}
let mut formats = FnvHashMap::new();
let mut formats = FnvHashMap();
// 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

View File

@ -133,7 +133,7 @@ impl<'a, 'tcx> ConstraintGraph<'a, 'tcx> {
name: String,
map: &'a ConstraintMap<'tcx>) -> ConstraintGraph<'a, 'tcx> {
let mut i = 0;
let mut node_ids = FnvHashMap::new();
let mut node_ids = FnvHashMap();
{
let mut add_node = |&mut : node| {
if let Vacant(e) = node_ids.entry(node) {
@ -188,7 +188,7 @@ fn constraint_to_nodes(c: &Constraint) -> (Node, Node) {
impl<'a, 'tcx> dot::GraphWalk<'a, Node, Edge> for ConstraintGraph<'a, 'tcx> {
fn nodes(&self) -> dot::Nodes<Node> {
let mut set = FnvHashSet::new();
let mut set = FnvHashSet();
for constraint in self.map.keys() {
let (n1, n2) = constraint_to_nodes(constraint);
set.insert(n1);

View File

@ -236,11 +236,11 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
tcx: tcx,
var_origins: RefCell::new(Vec::new()),
values: RefCell::new(None),
constraints: RefCell::new(FnvHashMap::new()),
constraints: RefCell::new(FnvHashMap()),
verifys: RefCell::new(Vec::new()),
givens: RefCell::new(FnvHashSet::new()),
lubs: RefCell::new(FnvHashMap::new()),
glbs: RefCell::new(FnvHashMap::new()),
givens: RefCell::new(FnvHashSet()),
lubs: RefCell::new(FnvHashMap()),
glbs: RefCell::new(FnvHashMap()),
skolemization_count: Cell::new(0),
bound_count: Cell::new(0),
undo_log: RefCell::new(Vec::new())
@ -1200,7 +1200,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
values: &Vec<VarValue>,
errors: &mut Vec<RegionResolutionError<'tcx>>)
{
let mut reg_reg_dups = FnvHashSet::new();
let mut reg_reg_dups = FnvHashSet();
for verify in self.verifys.borrow().iter() {
match *verify {
VerifyRegSubReg(ref origin, sub, sup) => {
@ -1476,7 +1476,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
dup_found: bool
}
let mut state = WalkState {
set: FnvHashSet::new(),
set: FnvHashSet(),
stack: vec!(orig_node_idx),
result: Vec::new(),
dup_found: false

View File

@ -167,7 +167,7 @@ impl<'a, 'v> Visitor<'v> for LanguageItemCollector<'a> {
impl<'a> LanguageItemCollector<'a> {
pub fn new(session: &'a Session) -> LanguageItemCollector<'a> {
let mut item_refs = FnvHashMap::new();
let mut item_refs = FnvHashMap();
$( item_refs.insert($name, $variant as uint); )*

View File

@ -277,9 +277,9 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
tcx: tcx,
num_live_nodes: 0,
num_vars: 0,
live_node_map: NodeMap::new(),
variable_map: NodeMap::new(),
capture_info_map: NodeMap::new(),
live_node_map: NodeMap(),
variable_map: NodeMap(),
capture_info_map: NodeMap(),
var_kinds: Vec::new(),
lnks: Vec::new(),
}
@ -582,8 +582,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
successors: repeat(invalid_node()).take(num_live_nodes).collect(),
users: repeat(invalid_users()).take(num_live_nodes * num_vars).collect(),
loop_scope: Vec::new(),
break_ln: NodeMap::new(),
cont_ln: NodeMap::new(),
break_ln: NodeMap(),
cont_ln: NodeMap(),
}
}

View File

@ -21,7 +21,7 @@ pub type PatIdMap = FnvHashMap<ast::Ident, ast::NodeId>;
// This is used because same-named variables in alternative patterns need to
// use the NodeId of their namesake in the first pattern.
pub fn pat_id_map(dm: &DefMap, pat: &ast::Pat) -> PatIdMap {
let mut map = FnvHashMap::new();
let mut map = FnvHashMap();
pat_bindings(dm, pat, |_bm, p_id, _s, path1| {
map.insert(path1.node, p_id);
});

View File

@ -169,7 +169,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
});
ReachableContext {
tcx: tcx,
reachable_symbols: NodeSet::new(),
reachable_symbols: NodeSet(),
worklist: Vec::new(),
any_library: any_library,
}

View File

@ -891,11 +891,11 @@ impl<'a, 'v> Visitor<'v> for RegionResolutionVisitor<'a> {
pub fn resolve_crate(sess: &Session, krate: &ast::Crate) -> RegionMaps {
let maps = RegionMaps {
scope_map: RefCell::new(FnvHashMap::new()),
var_map: RefCell::new(NodeMap::new()),
free_region_map: RefCell::new(FnvHashMap::new()),
rvalue_scopes: RefCell::new(NodeMap::new()),
terminating_scopes: RefCell::new(FnvHashSet::new()),
scope_map: RefCell::new(FnvHashMap()),
var_map: RefCell::new(NodeMap()),
free_region_map: RefCell::new(FnvHashMap()),
rvalue_scopes: RefCell::new(NodeMap()),
terminating_scopes: RefCell::new(FnvHashSet()),
};
{
let mut visitor = RegionResolutionVisitor {

View File

@ -74,7 +74,7 @@ type Scope<'a> = &'a ScopeChain<'a>;
static ROOT_SCOPE: ScopeChain<'static> = RootScope;
pub fn krate(sess: &Session, krate: &ast::Crate, def_map: &DefMap) -> NamedRegionMap {
let mut named_region_map = NodeMap::new();
let mut named_region_map = NodeMap();
visit::walk_crate(&mut LifetimeContext {
sess: sess,
named_region_map: &mut named_region_map,

View File

@ -141,8 +141,8 @@ impl Index {
pub fn build(krate: &Crate) -> Index {
let mut annotator = Annotator {
index: Index {
local: NodeMap::new(),
extern_cache: DefIdMap::new()
local: NodeMap(),
extern_cache: DefIdMap()
},
parent: None
};

View File

@ -96,7 +96,7 @@ impl<'tcx> FulfillmentContext<'tcx> {
duplicate_set: HashSet::new(),
predicates: Vec::new(),
attempted_mark: 0,
region_obligations: NodeMap::new(),
region_obligations: NodeMap(),
}
}

View File

@ -2362,71 +2362,71 @@ pub fn mk_ctxt<'tcx>(s: Session,
lang_items: middle::lang_items::LanguageItems,
stability: stability::Index) -> ctxt<'tcx>
{
let mut interner = FnvHashMap::new();
let mut interner = FnvHashMap();
let common_types = CommonTypes::new(&arenas.type_, &mut interner);
ctxt {
arenas: arenas,
interner: RefCell::new(interner),
substs_interner: RefCell::new(FnvHashMap::new()),
bare_fn_interner: RefCell::new(FnvHashMap::new()),
region_interner: RefCell::new(FnvHashMap::new()),
substs_interner: RefCell::new(FnvHashMap()),
bare_fn_interner: RefCell::new(FnvHashMap()),
region_interner: RefCell::new(FnvHashMap()),
types: common_types,
named_region_map: named_region_map,
item_variance_map: RefCell::new(DefIdMap::new()),
item_variance_map: RefCell::new(DefIdMap()),
variance_computed: Cell::new(false),
sess: s,
def_map: dm,
region_maps: region_maps,
node_types: RefCell::new(FnvHashMap::new()),
item_substs: RefCell::new(NodeMap::new()),
trait_refs: RefCell::new(NodeMap::new()),
trait_defs: RefCell::new(DefIdMap::new()),
object_cast_map: RefCell::new(NodeMap::new()),
node_types: RefCell::new(FnvHashMap()),
item_substs: RefCell::new(NodeMap()),
trait_refs: RefCell::new(NodeMap()),
trait_defs: RefCell::new(DefIdMap()),
object_cast_map: RefCell::new(NodeMap()),
map: map,
intrinsic_defs: RefCell::new(DefIdMap::new()),
intrinsic_defs: RefCell::new(DefIdMap()),
freevars: freevars,
tcache: RefCell::new(DefIdMap::new()),
rcache: RefCell::new(FnvHashMap::new()),
short_names_cache: RefCell::new(FnvHashMap::new()),
tc_cache: RefCell::new(FnvHashMap::new()),
ast_ty_to_ty_cache: RefCell::new(NodeMap::new()),
enum_var_cache: RefCell::new(DefIdMap::new()),
impl_or_trait_items: RefCell::new(DefIdMap::new()),
trait_item_def_ids: RefCell::new(DefIdMap::new()),
trait_items_cache: RefCell::new(DefIdMap::new()),
impl_trait_cache: RefCell::new(DefIdMap::new()),
ty_param_defs: RefCell::new(NodeMap::new()),
adjustments: RefCell::new(NodeMap::new()),
normalized_cache: RefCell::new(FnvHashMap::new()),
tcache: RefCell::new(DefIdMap()),
rcache: RefCell::new(FnvHashMap()),
short_names_cache: RefCell::new(FnvHashMap()),
tc_cache: RefCell::new(FnvHashMap()),
ast_ty_to_ty_cache: RefCell::new(NodeMap()),
enum_var_cache: RefCell::new(DefIdMap()),
impl_or_trait_items: RefCell::new(DefIdMap()),
trait_item_def_ids: RefCell::new(DefIdMap()),
trait_items_cache: RefCell::new(DefIdMap()),
impl_trait_cache: RefCell::new(DefIdMap()),
ty_param_defs: RefCell::new(NodeMap()),
adjustments: RefCell::new(NodeMap()),
normalized_cache: RefCell::new(FnvHashMap()),
lang_items: lang_items,
provided_method_sources: RefCell::new(DefIdMap::new()),
struct_fields: RefCell::new(DefIdMap::new()),
destructor_for_type: RefCell::new(DefIdMap::new()),
destructors: RefCell::new(DefIdSet::new()),
trait_impls: RefCell::new(DefIdMap::new()),
inherent_impls: RefCell::new(DefIdMap::new()),
impl_items: RefCell::new(DefIdMap::new()),
used_unsafe: RefCell::new(NodeSet::new()),
used_mut_nodes: RefCell::new(NodeSet::new()),
populated_external_types: RefCell::new(DefIdSet::new()),
populated_external_traits: RefCell::new(DefIdSet::new()),
upvar_borrow_map: RefCell::new(FnvHashMap::new()),
extern_const_statics: RefCell::new(DefIdMap::new()),
extern_const_variants: RefCell::new(DefIdMap::new()),
method_map: RefCell::new(FnvHashMap::new()),
dependency_formats: RefCell::new(FnvHashMap::new()),
unboxed_closures: RefCell::new(DefIdMap::new()),
node_lint_levels: RefCell::new(FnvHashMap::new()),
provided_method_sources: RefCell::new(DefIdMap()),
struct_fields: RefCell::new(DefIdMap()),
destructor_for_type: RefCell::new(DefIdMap()),
destructors: RefCell::new(DefIdSet()),
trait_impls: RefCell::new(DefIdMap()),
inherent_impls: RefCell::new(DefIdMap()),
impl_items: RefCell::new(DefIdMap()),
used_unsafe: RefCell::new(NodeSet()),
used_mut_nodes: RefCell::new(NodeSet()),
populated_external_types: RefCell::new(DefIdSet()),
populated_external_traits: RefCell::new(DefIdSet()),
upvar_borrow_map: RefCell::new(FnvHashMap()),
extern_const_statics: RefCell::new(DefIdMap()),
extern_const_variants: RefCell::new(DefIdMap()),
method_map: RefCell::new(FnvHashMap()),
dependency_formats: RefCell::new(FnvHashMap()),
unboxed_closures: RefCell::new(DefIdMap()),
node_lint_levels: RefCell::new(FnvHashMap()),
transmute_restrictions: RefCell::new(Vec::new()),
stability: RefCell::new(stability),
capture_modes: capture_modes,
associated_types: RefCell::new(DefIdMap::new()),
associated_types: RefCell::new(DefIdMap()),
selection_cache: traits::SelectionCache::new(),
repr_hint_cache: RefCell::new(DefIdMap::new()),
repr_hint_cache: RefCell::new(DefIdMap()),
type_impls_copy_cache: RefCell::new(HashMap::new()),
type_impls_sized_cache: RefCell::new(HashMap::new()),
object_safety_cache: RefCell::new(DefIdMap::new()),
object_safety_cache: RefCell::new(DefIdMap()),
}
}
@ -3331,7 +3331,7 @@ pub fn type_interior_is_unsafe<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
return memoized(&cx.tc_cache, ty, |ty| {
tc_ty(cx, ty, &mut FnvHashMap::new())
tc_ty(cx, ty, &mut FnvHashMap())
});
fn tc_ty<'tcx>(cx: &ctxt<'tcx>,
@ -6760,7 +6760,7 @@ pub fn replace_late_bound_regions<'tcx, T, F>(
{
debug!("replace_late_bound_regions({})", binder.repr(tcx));
let mut map = FnvHashMap::new();
let mut map = FnvHashMap();
// Note: fold the field `0`, not the binder, so that late-bound
// regions bound by `binder` are considered free.

View File

@ -346,7 +346,7 @@ pub fn build_session_(sopts: config::Options,
local_crate_source_file: local_crate_source_file,
working_dir: os::getcwd().unwrap(),
lint_store: RefCell::new(lint::LintStore::new()),
lints: RefCell::new(NodeMap::new()),
lints: RefCell::new(NodeMap()),
crate_types: RefCell::new(Vec::new()),
crate_metadata: RefCell::new(Vec::new()),
features: RefCell::new(feature_gate::Features::new()),

View File

@ -15,7 +15,7 @@
use std::collections::hash_state::{DefaultState};
use std::collections::{HashMap, HashSet};
use std::default::Default;
use std::hash::{Hasher, Writer};
use std::hash::{Hasher, Writer, Hash};
use syntax::ast;
pub type FnvHashMap<K, V> = HashMap<K, V, DefaultState<FnvHasher>>;
@ -27,42 +27,18 @@ pub type DefIdMap<T> = FnvHashMap<ast::DefId, T>;
pub type NodeSet = FnvHashSet<ast::NodeId>;
pub type DefIdSet = FnvHashSet<ast::DefId>;
// Hacks to get good names
pub mod FnvHashMap {
use std::hash::Hash;
use std::default::Default;
pub fn new<K: Hash<super::FnvHasher> + Eq, V>() -> super::FnvHashMap<K, V> {
Default::default()
}
pub fn FnvHashMap<K: Hash<FnvHasher> + Eq, V>() -> FnvHashMap<K, V> {
Default::default()
}
pub mod FnvHashSet {
use std::hash::Hash;
use std::default::Default;
pub fn new<V: Hash<super::FnvHasher> + Eq>() -> super::FnvHashSet<V> {
Default::default()
}
}
pub mod NodeMap {
pub fn new<T>() -> super::NodeMap<T> {
super::FnvHashMap::new()
}
}
pub mod DefIdMap {
pub fn new<T>() -> super::DefIdMap<T> {
super::FnvHashMap::new()
}
}
pub mod NodeSet {
pub fn new() -> super::NodeSet {
super::FnvHashSet::new()
}
}
pub mod DefIdSet {
pub fn new() -> super::DefIdSet {
super::FnvHashSet::new()
}
pub fn FnvHashSet<V: Hash<FnvHasher> + Eq>() -> FnvHashSet<V> {
Default::default()
}
pub fn NodeMap<T>() -> NodeMap<T> { FnvHashMap() }
pub fn DefIdMap<T>() -> DefIdMap<T> { FnvHashMap() }
pub fn NodeSet() -> NodeSet { FnvHashSet() }
pub fn DefIdSet() -> DefIdSet { FnvHashSet() }
/// A speedy hash algorithm for node ids and def ids. The hashmap in
/// libcollections by default uses SipHash which isn't quite as speedy as we
/// want. In the compiler we're not really worried about DOS attempts, so we

View File

@ -209,12 +209,12 @@ impl<'tcx> MoveData<'tcx> {
pub fn new() -> MoveData<'tcx> {
MoveData {
paths: RefCell::new(Vec::new()),
path_map: RefCell::new(FnvHashMap::new()),
path_map: RefCell::new(FnvHashMap()),
moves: RefCell::new(Vec::new()),
path_assignments: RefCell::new(Vec::new()),
var_assignments: RefCell::new(Vec::new()),
variant_matches: RefCell::new(Vec::new()),
assignee_ids: RefCell::new(NodeSet::new()),
assignee_ids: RefCell::new(NodeSet()),
fragments: RefCell::new(fragments::FragmentSets::new()),
}
}

View File

@ -1539,7 +1539,7 @@ pub fn check_crate(tcx: &ty::ctxt,
// Figure out who everyone's parent is
let mut visitor = ParentVisitor {
parents: NodeMap::new(),
parents: NodeMap(),
curparent: ast::DUMMY_NODE_ID,
};
visit::walk_crate(&mut visitor, krate);
@ -1569,9 +1569,9 @@ pub fn check_crate(tcx: &ty::ctxt,
// items which are reachable from external crates based on visibility.
let mut visitor = EmbargoVisitor {
tcx: tcx,
exported_items: NodeSet::new(),
public_items: NodeSet::new(),
reexports: NodeSet::new(),
exported_items: NodeSet(),
public_items: NodeSet(),
reexports: NodeSet(),
export_map: export_map,
prev_exported: true,
prev_public: true,

View File

@ -523,7 +523,7 @@ impl Module {
children: RefCell::new(HashMap::new()),
imports: RefCell::new(Vec::new()),
external_module_children: RefCell::new(HashMap::new()),
anonymous_children: RefCell::new(NodeMap::new()),
anonymous_children: RefCell::new(NodeMap()),
import_resolutions: RefCell::new(HashMap::new()),
glob_count: Cell::new(0),
resolved_import_count: Cell::new(0),
@ -943,8 +943,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
graph_root: graph_root,
trait_item_map: FnvHashMap::new(),
structs: FnvHashMap::new(),
trait_item_map: FnvHashMap(),
structs: FnvHashMap(),
unresolved_imports: 0,
@ -961,16 +961,16 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
primitive_type_table: PrimitiveTypeTable::new(),
def_map: RefCell::new(NodeMap::new()),
freevars: RefCell::new(NodeMap::new()),
freevars_seen: RefCell::new(NodeMap::new()),
capture_mode_map: NodeMap::new(),
export_map: NodeMap::new(),
trait_map: NodeMap::new(),
def_map: RefCell::new(NodeMap()),
freevars: RefCell::new(NodeMap()),
freevars_seen: RefCell::new(NodeMap()),
capture_mode_map: NodeMap(),
export_map: NodeMap(),
trait_map: NodeMap(),
used_imports: HashSet::new(),
used_crates: HashSet::new(),
external_exports: DefIdSet::new(),
last_private: NodeMap::new(),
external_exports: DefIdSet(),
last_private: NodeMap(),
emit_errors: true,
make_glob_map: make_glob_map == MakeGlobMap::Yes,
@ -2635,7 +2635,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let mut seen = self.freevars_seen.borrow_mut();
let seen = match seen.entry(function_id) {
Occupied(v) => v.into_mut(),
Vacant(v) => v.insert(NodeSet::new()),
Vacant(v) => v.insert(NodeSet()),
};
if seen.contains(&node_id) {
continue;

View File

@ -1306,7 +1306,7 @@ fn create_bindings_map<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pat: &ast::Pat,
let ccx = bcx.ccx();
let tcx = bcx.tcx();
let reassigned = is_discr_reassigned(bcx, discr, body);
let mut bindings_map = FnvHashMap::new();
let mut bindings_map = FnvHashMap();
pat_bindings(&tcx.def_map, &*pat, |bm, p_id, span, path1| {
let ident = path1.node;
let variable_ty = node_id_type(bcx, p_id);

View File

@ -1461,8 +1461,8 @@ pub fn new_fn_ctxt<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>,
needs_ret_allocas: nested_returns,
personality: Cell::new(None),
caller_expects_out_pointer: uses_outptr,
lllocals: RefCell::new(NodeMap::new()),
llupvars: RefCell::new(NodeMap::new()),
lllocals: RefCell::new(NodeMap()),
llupvars: RefCell::new(NodeMap()),
id: id,
param_substs: param_substs,
span: sp,

View File

@ -59,7 +59,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// Build version of path with cycles removed.
// Pass 1: scan table mapping str -> rightmost pos.
let mut mm = FnvHashMap::new();
let mut mm = FnvHashMap();
let len = v.len();
let mut i = 0u;
while i < len {

View File

@ -176,7 +176,7 @@ pub fn unsized_part_of_type<'tcx>(cx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx>
// cleanups.
pub fn type_needs_unwind_cleanup<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) -> bool {
return memoized(ccx.needs_unwind_cleanup_cache(), ty, |ty| {
type_needs_unwind_cleanup_(ccx.tcx(), ty, &mut FnvHashSet::new())
type_needs_unwind_cleanup_(ccx.tcx(), ty, &mut FnvHashSet())
});
fn type_needs_unwind_cleanup_<'tcx>(tcx: &ty::ctxt<'tcx>,

View File

@ -253,7 +253,7 @@ impl<'tcx> SharedCrateContext<'tcx> {
metadata_llcx: metadata_llcx,
export_map: export_map,
reachable: reachable,
item_symbols: RefCell::new(NodeMap::new()),
item_symbols: RefCell::new(NodeMap()),
link_meta: link_meta,
symbol_hasher: RefCell::new(symbol_hasher),
tcx: tcx,
@ -267,11 +267,11 @@ impl<'tcx> SharedCrateContext<'tcx> {
n_inlines: Cell::new(0u),
n_closures: Cell::new(0u),
n_llvm_insns: Cell::new(0u),
llvm_insns: RefCell::new(FnvHashMap::new()),
llvm_insns: RefCell::new(FnvHashMap()),
fn_stats: RefCell::new(Vec::new()),
},
available_monomorphizations: RefCell::new(FnvHashSet::new()),
available_drop_glues: RefCell::new(FnvHashMap::new()),
available_monomorphizations: RefCell::new(FnvHashSet()),
available_drop_glues: RefCell::new(FnvHashMap()),
};
for i in range(0, local_count) {
@ -387,39 +387,39 @@ impl<'tcx> LocalCrateContext<'tcx> {
llcx: llcx,
td: td,
tn: TypeNames::new(),
externs: RefCell::new(FnvHashMap::new()),
item_vals: RefCell::new(NodeMap::new()),
needs_unwind_cleanup_cache: RefCell::new(FnvHashMap::new()),
fn_pointer_shims: RefCell::new(FnvHashMap::new()),
drop_glues: RefCell::new(FnvHashMap::new()),
tydescs: RefCell::new(FnvHashMap::new()),
externs: RefCell::new(FnvHashMap()),
item_vals: RefCell::new(NodeMap()),
needs_unwind_cleanup_cache: RefCell::new(FnvHashMap()),
fn_pointer_shims: RefCell::new(FnvHashMap()),
drop_glues: RefCell::new(FnvHashMap()),
tydescs: RefCell::new(FnvHashMap()),
finished_tydescs: Cell::new(false),
external: RefCell::new(DefIdMap::new()),
external_srcs: RefCell::new(NodeMap::new()),
monomorphized: RefCell::new(FnvHashMap::new()),
monomorphizing: RefCell::new(DefIdMap::new()),
vtables: RefCell::new(FnvHashMap::new()),
const_cstr_cache: RefCell::new(FnvHashMap::new()),
const_globals: RefCell::new(FnvHashMap::new()),
const_values: RefCell::new(NodeMap::new()),
static_values: RefCell::new(NodeMap::new()),
extern_const_values: RefCell::new(DefIdMap::new()),
impl_method_cache: RefCell::new(FnvHashMap::new()),
closure_bare_wrapper_cache: RefCell::new(FnvHashMap::new()),
lltypes: RefCell::new(FnvHashMap::new()),
llsizingtypes: RefCell::new(FnvHashMap::new()),
adt_reprs: RefCell::new(FnvHashMap::new()),
type_hashcodes: RefCell::new(FnvHashMap::new()),
all_llvm_symbols: RefCell::new(FnvHashSet::new()),
external: RefCell::new(DefIdMap()),
external_srcs: RefCell::new(NodeMap()),
monomorphized: RefCell::new(FnvHashMap()),
monomorphizing: RefCell::new(DefIdMap()),
vtables: RefCell::new(FnvHashMap()),
const_cstr_cache: RefCell::new(FnvHashMap()),
const_globals: RefCell::new(FnvHashMap()),
const_values: RefCell::new(NodeMap()),
static_values: RefCell::new(NodeMap()),
extern_const_values: RefCell::new(DefIdMap()),
impl_method_cache: RefCell::new(FnvHashMap()),
closure_bare_wrapper_cache: RefCell::new(FnvHashMap()),
lltypes: RefCell::new(FnvHashMap()),
llsizingtypes: RefCell::new(FnvHashMap()),
adt_reprs: RefCell::new(FnvHashMap()),
type_hashcodes: RefCell::new(FnvHashMap()),
all_llvm_symbols: RefCell::new(FnvHashSet()),
int_type: Type::from_ref(ptr::null_mut()),
opaque_vec_type: Type::from_ref(ptr::null_mut()),
builder: BuilderRef_res(llvm::LLVMCreateBuilderInContext(llcx)),
unboxed_closure_vals: RefCell::new(FnvHashMap::new()),
unboxed_closure_vals: RefCell::new(FnvHashMap()),
dbg_cx: dbg_cx,
eh_personality: RefCell::new(None),
intrinsics: RefCell::new(FnvHashMap::new()),
intrinsics: RefCell::new(FnvHashMap()),
n_llvm_insns: Cell::new(0u),
trait_cache: RefCell::new(FnvHashMap::new()),
trait_cache: RefCell::new(FnvHashMap()),
};
local_ccx.int_type = Type::int(&local_ccx.dummy_ccx(shared));

View File

@ -271,9 +271,9 @@ impl<'tcx> TypeMap<'tcx> {
fn new() -> TypeMap<'tcx> {
TypeMap {
unique_id_interner: Interner::new(),
type_to_metadata: FnvHashMap::new(),
unique_id_to_metadata: FnvHashMap::new(),
type_to_unique_id: FnvHashMap::new(),
type_to_metadata: FnvHashMap(),
unique_id_to_metadata: FnvHashMap(),
type_to_unique_id: FnvHashMap(),
}
}
@ -672,11 +672,11 @@ impl<'tcx> CrateDebugContext<'tcx> {
llcontext: llcontext,
builder: builder,
current_debug_location: Cell::new(UnknownLocation),
created_files: RefCell::new(FnvHashMap::new()),
created_enum_disr_types: RefCell::new(DefIdMap::new()),
created_files: RefCell::new(FnvHashMap()),
created_enum_disr_types: RefCell::new(DefIdMap()),
type_map: RefCell::new(TypeMap::new()),
namespace_map: RefCell::new(FnvHashMap::new()),
composite_types_completed: RefCell::new(FnvHashSet::new()),
namespace_map: RefCell::new(FnvHashMap()),
composite_types_completed: RefCell::new(FnvHashSet()),
};
}
}
@ -3228,7 +3228,7 @@ fn create_scope_map(cx: &CrateContext,
fn_metadata: DISubprogram,
fn_ast_id: ast::NodeId)
-> NodeMap<DIScope> {
let mut scope_map = NodeMap::new();
let mut scope_map = NodeMap();
let def_map = &cx.tcx().def_map;

View File

@ -352,7 +352,7 @@ pub struct TypeNames {
impl TypeNames {
pub fn new() -> TypeNames {
TypeNames {
named_types: RefCell::new(FnvHashMap::new())
named_types: RefCell::new(FnvHashMap())
}
}

View File

@ -1711,7 +1711,7 @@ pub fn partition_bounds<'a>(tcx: &ty::ctxt,
let mut builtin_bounds = ty::empty_builtin_bounds();
let mut region_bounds = Vec::new();
let mut trait_bounds = Vec::new();
let mut trait_def_ids = DefIdMap::new();
let mut trait_def_ids = DefIdMap();
for ast_bound in ast_bounds.iter() {
match *ast_bound {
ast::TraitTyParamBound(ref b, ast::TraitBoundModifier::None) => {

View File

@ -592,7 +592,7 @@ pub fn check_struct_pat_fields<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
.collect::<FnvHashMap<_, _>>();
// Keep track of which fields have already appeared in the pattern.
let mut used_fields = FnvHashMap::new();
let mut used_fields = FnvHashMap();
// Typecheck each field.
for &Spanned { node: ref field, span } in fields.iter() {

View File

@ -373,16 +373,16 @@ impl<'a, 'tcx> Inherited<'a, 'tcx> {
-> Inherited<'a, 'tcx> {
Inherited {
infcx: infer::new_infer_ctxt(tcx),
locals: RefCell::new(NodeMap::new()),
locals: RefCell::new(NodeMap()),
param_env: param_env,
node_types: RefCell::new(NodeMap::new()),
item_substs: RefCell::new(NodeMap::new()),
adjustments: RefCell::new(NodeMap::new()),
method_map: RefCell::new(FnvHashMap::new()),
object_cast_map: RefCell::new(NodeMap::new()),
upvar_borrow_map: RefCell::new(FnvHashMap::new()),
unboxed_closures: RefCell::new(DefIdMap::new()),
fn_sig_map: RefCell::new(NodeMap::new()),
node_types: RefCell::new(NodeMap()),
item_substs: RefCell::new(NodeMap()),
adjustments: RefCell::new(NodeMap()),
method_map: RefCell::new(FnvHashMap()),
object_cast_map: RefCell::new(NodeMap()),
upvar_borrow_map: RefCell::new(FnvHashMap()),
unboxed_closures: RefCell::new(DefIdMap()),
fn_sig_map: RefCell::new(NodeMap()),
fulfillment_cx: RefCell::new(traits::FulfillmentContext::new()),
}
}
@ -3153,7 +3153,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
enum_id_opt: Option<ast::DefId>) {
let tcx = fcx.ccx.tcx;
let mut class_field_map = FnvHashMap::new();
let mut class_field_map = FnvHashMap();
let mut fields_found = 0;
for field in field_types.iter() {
class_field_map.insert(field.name, (field.id, false));

View File

@ -595,7 +595,7 @@ pub fn check_coherence(crate_context: &CrateCtxt) {
CoherenceChecker {
crate_context: crate_context,
inference_context: new_infer_ctxt(crate_context.tcx),
inherent_impls: RefCell::new(FnvHashMap::new()),
inherent_impls: RefCell::new(FnvHashMap()),
}.check(crate_context.tcx.map.krate());
impls::check(crate_context.tcx);
unsafety::check(crate_context.tcx);

View File

@ -449,7 +449,7 @@ fn convert_methods<'a,'tcx,'i,I>(ccx: &CollectCtxt<'a, 'tcx>,
rcvr_ty_generics.repr(ccx.tcx));
let tcx = ccx.tcx;
let mut seen_methods = FnvHashSet::new();
let mut seen_methods = FnvHashSet();
for m in ms {
if !seen_methods.insert(m.pe_ident().repr(tcx)) {
tcx.sess.span_err(m.span, "duplicate method in trait impl");
@ -737,7 +737,7 @@ fn convert_struct<'a, 'tcx>(ccx: &CollectCtxt<'a, 'tcx>,
let tcx = ccx.tcx;
// Write the type of each of the members and check for duplicate fields.
let mut seen_fields: FnvHashMap<ast::Name, Span> = FnvHashMap::new();
let mut seen_fields: FnvHashMap<ast::Name, Span> = FnvHashMap();
let field_tys = struct_def.fields.iter().map(|f| {
let result = convert_field(ccx, &scheme.generics, f, local_def(id));

View File

@ -288,7 +288,7 @@ fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: &'a ty::ctxt<'tcx>,
let mut terms_cx = TermsContext {
tcx: tcx,
arena: arena,
inferred_map: NodeMap::new(),
inferred_map: NodeMap(),
inferred_infos: Vec::new(),
// cache and share the variance struct used for items with

View File

@ -313,7 +313,7 @@ pub fn run(mut krate: clean::Crate,
let analysis = ::ANALYSISKEY.with(|a| a.clone());
let analysis = analysis.borrow();
let public_items = analysis.as_ref().map(|a| a.public_items.clone());
let public_items = public_items.unwrap_or(NodeSet::new());
let public_items = public_items.unwrap_or(NodeSet());
let paths: HashMap<ast::DefId, (Vec<String>, ItemType)> =
analysis.as_ref().map(|a| {
let paths = a.external_paths.borrow_mut().take().unwrap();