Remove redundant hashmap constructor functions.

This commit is contained in:
Graydon Hoare 2012-09-19 15:13:04 -07:00
parent 384906c1e8
commit 1ffd90edbc
53 changed files with 155 additions and 219 deletions

View File

@ -668,11 +668,11 @@ fn configure(opts: options) -> cargo {
let p = result::get(get_cargo_dir());
let sources = map::str_hash();
let sources = map::HashMap();
try_parse_sources(&home.push("sources.json"), sources);
try_parse_sources(&home.push("local-sources.json"), sources);
let dep_cache = map::str_hash();
let dep_cache = map::HashMap();
let mut c = {
pgp: pgp::supported(),
@ -1577,7 +1577,7 @@ fn dump_cache(c: &cargo) {
need_dir(&c.root);
let out = c.root.push("cache.json");
let _root = json::Dict(map::str_hash());
let _root = json::Dict(map::HashMap());
if os::path_exists(&out) {
copy_warn(&out, &c.root.push("cache.json.old"));
@ -1598,11 +1598,11 @@ fn dump_sources(c: &cargo) {
match io::buffered_file_writer(&out) {
result::Ok(writer) => {
let hash = map::str_hash();
let hash = map::HashMap();
let root = json::Dict(hash);
for c.sources.each |k, v| {
let chash = map::str_hash();
let chash = map::HashMap();
let child = json::Dict(chash);
chash.insert(~"url", json::String(@v.url));

View File

@ -517,7 +517,7 @@ impl Parser {
self.bump();
self.parse_whitespace();
let values = map::str_hash();
let values = map::HashMap();
if self.ch == '}' {
self.bump();
@ -802,7 +802,7 @@ impl <A: ToJson> ~[A]: ToJson {
impl <A: ToJson Copy> HashMap<~str, A>: ToJson {
fn to_json() -> Json {
let d = map::str_hash();
let d = map::HashMap();
for self.each() |key, value| {
d.insert(copy key, value.to_json());
}
@ -832,7 +832,7 @@ impl Error: to_str::ToStr {
#[cfg(test)]
mod tests {
fn mk_dict(items: &[(~str, Json)]) -> Json {
let d = map::str_hash();
let d = map::HashMap();
for vec::each(items) |item| {
let (key, value) = copy *item;

View File

@ -12,11 +12,8 @@ use core::cmp::Eq;
use hash::Hash;
use to_bytes::IterBytes;
export HashMap, hashfn, eqfn, Set, Map, chained, hashmap, str_hash;
export box_str_hash;
export bytes_hash, int_hash, uint_hash, set_add;
export hash_from_vec, hash_from_strs, hash_from_bytes;
export hash_from_ints, hash_from_uints;
export HashMap, hashfn, eqfn, Set, Map, chained, set_add;
export hash_from_vec;
export vec_from_set;
/// A convenience type to treat a hashmap as a set
@ -385,36 +382,6 @@ fn HashMap<K:Eq IterBytes Hash Const, V: Copy>()
chained::mk()
}
/// Construct a hashmap for string-slice keys
fn str_slice_hash<V: Copy>() -> HashMap<&str, V> {
return HashMap();
}
/// Construct a hashmap for string keys
fn str_hash<V: Copy>() -> HashMap<~str, V> {
return HashMap();
}
/// Construct a hashmap for boxed string keys
fn box_str_hash<V: Copy>() -> HashMap<@~str, V> {
HashMap()
}
/// Construct a hashmap for byte string keys
fn bytes_hash<V: Copy>() -> HashMap<~[u8], V> {
return HashMap();
}
/// Construct a hashmap for int keys
fn int_hash<V: Copy>() -> HashMap<int, V> {
return HashMap();
}
/// Construct a hashmap for uint keys
fn uint_hash<V: Copy>() -> HashMap<uint, V> {
return HashMap();
}
/// Convenience function for adding keys to a hashmap with nil type keys
fn set_add<K:Eq IterBytes Hash Const Copy>(set: Set<K>, +key: K) -> bool {
set.insert(key, ())
@ -445,26 +412,6 @@ fn hash_from_vec<K: Eq IterBytes Hash Const Copy, V: Copy>(
map
}
/// Construct a hashmap from a vector with string keys
fn hash_from_strs<V: Copy>(items: &[(~str, V)]) -> HashMap<~str, V> {
hash_from_vec(items)
}
/// Construct a hashmap from a vector with byte keys
fn hash_from_bytes<V: Copy>(items: &[(~[u8], V)]) -> HashMap<~[u8], V> {
hash_from_vec(items)
}
/// Construct a hashmap from a vector with int keys
fn hash_from_ints<V: Copy>(items: &[(int, V)]) -> HashMap<int, V> {
hash_from_vec(items)
}
/// Construct a hashmap from a vector with uint keys
fn hash_from_uints<V: Copy>(items: &[(uint, V)]) -> HashMap<uint, V> {
hash_from_vec(items)
}
// XXX Transitional
impl<K: Eq IterBytes Hash Copy, V: Copy> @Mut<LinearMap<K, V>>:
Map<K, V> {
@ -810,7 +757,7 @@ mod tests {
#[test]
fn test_hash_from_vec() {
let map = map::hash_from_strs(~[
let map = map::hash_from_vec(~[
(~"a", 1),
(~"b", 2),
(~"c", 3)

View File

@ -3,7 +3,7 @@
#[forbid(deprecated_pattern)];
use core::cmp::Eq;
use map::{HashMap, str_hash};
use map::HashMap;
use io::{Reader, ReaderUtil};
use dvec::DVec;
use from_str::FromStr;
@ -213,7 +213,7 @@ fn encode_form_urlencoded(m: HashMap<~str, @DVec<@~str>>) -> ~str {
fn decode_form_urlencoded(s: ~[u8]) ->
map::HashMap<~str, @dvec::DVec<@~str>> {
do io::with_bytes_reader(s) |rdr| {
let m = str_hash();
let m = HashMap();
let mut key = ~"";
let mut value = ~"";
let mut parsing_key = true;
@ -1069,26 +1069,24 @@ mod tests {
#[test]
fn test_encode_form_urlencoded() {
let m = str_hash();
let m = HashMap();
assert encode_form_urlencoded(m) == ~"";
m.insert(~"", @DVec());
m.insert(~"foo", @DVec());
assert encode_form_urlencoded(m) == ~"";
let m = str_hash();
let m = HashMap();
m.insert(~"foo", @dvec::from_vec(~[@~"bar", @~"123"]));
assert encode_form_urlencoded(m) == ~"foo=bar&foo=123";
let m = str_hash();
let m = HashMap();
m.insert(~"foo bar", @dvec::from_vec(~[@~"abc", @~"12 = 34"]));
assert encode_form_urlencoded(m) == ~"foo+bar=abc&foo+bar=12+%3D+34";
}
#[test]
fn test_decode_form_urlencoded() {
use map::hash_from_strs;
assert decode_form_urlencoded(~[]).size() == 0;
let s = str::to_bytes(~"a=1&foo+bar=abc&foo+bar=12+%3D+34");

View File

@ -103,7 +103,7 @@ fn mk_ast_map_visitor() -> vt {
}
fn map_crate(diag: span_handler, c: crate) -> map {
let cx = {map: std::map::int_hash(),
let cx = {map: std::map::HashMap(),
mut path: ~[],
mut local_id: 0u,
diag: diag};

View File

@ -259,10 +259,6 @@ impl def_id : core::to_bytes::IterBytes {
}
}
fn new_def_hash<V: Copy>() -> std::map::HashMap<ast::def_id, V> {
return std::map::HashMap::<ast::def_id, V>();
}
fn block_from_expr(e: @expr) -> blk {
let blk_ = default_block(~[], option::Some::<@expr>(e), e.id);
return {node: blk_, span: e.span};

View File

@ -368,7 +368,7 @@ fn find_inline_attr(attrs: ~[ast::attribute]) -> inline_attr {
fn require_unique_names(diagnostic: span_handler,
metas: ~[@ast::meta_item]) {
let map = map::str_hash();
let map = map::HashMap();
for metas.each |meta| {
let name = get_meta_item_name(meta);

View File

@ -564,7 +564,7 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: ast::ident,
id: cx.next_id()}],
tp_inputs);
let tps_map = map::uint_hash();
let tps_map = map::HashMap();
do vec::iter2(tps, tp_inputs) |tp, arg| {
let arg_ident = arg.ident;
tps_map.insert(
@ -771,7 +771,7 @@ fn mk_deser_fn(cx: ext_ctxt, span: span,
id: cx.next_id()}],
tp_inputs);
let tps_map = map::uint_hash();
let tps_map = map::HashMap();
do vec::iter2(tps, tp_inputs) |tp, arg| {
let arg_ident = arg.ident;
tps_map.insert(

View File

@ -2,7 +2,6 @@ use std::map::HashMap;
use parse::parser;
use diagnostic::span_handler;
use codemap::{codemap, span, expn_info, expanded_from};
use std::map::str_hash;
// obsolete old-style #macro code:
//
@ -74,7 +73,7 @@ fn syntax_expander_table() -> HashMap<~str, syntax_extension> {
fn builtin_item_tt(f: syntax_expander_tt_item_) -> syntax_extension {
item_tt({expander: f, span: None})
}
let syntax_expanders = str_hash::<syntax_extension>();
let syntax_expanders = HashMap::<~str,syntax_extension>();
syntax_expanders.insert(~"macro",
macro_defining(ext::simplext::add_new_extension));
syntax_expanders.insert(~"macro_rules",

View File

@ -1,5 +1,5 @@
use codemap::span;
use std::map::{HashMap, str_hash, uint_hash};
use std::map::HashMap;
use dvec::DVec;
use base::*;
@ -135,7 +135,7 @@ fn acumm_bindings(_cx: ext_ctxt, _b_dest: bindings, _b_src: bindings) { }
fn pattern_to_selectors(cx: ext_ctxt, e: @expr) -> binders {
let res: binders =
{real_binders: uint_hash::<selector>(),
{real_binders: HashMap(),
literal_ast_matchers: DVec()};
//this oughta return binders instead, but macro args are a sequence of
//expressions, rather than a single expression
@ -153,7 +153,7 @@ bindings. Most of the work is done in p_t_s, which generates the
selectors. */
fn use_selectors_to_bind(b: binders, e: @expr) -> Option<bindings> {
let res = uint_hash::<arb_depth<matchable>>();
let res = HashMap();
//need to do this first, to check vec lengths.
for b.literal_ast_matchers.each |sel| {
match sel(match_expr(e)) { None => return None, _ => () }
@ -237,7 +237,7 @@ fn follow_for_trans(cx: ext_ctxt, mmaybe: Option<arb_depth<matchable>>,
/* helper for transcribe_exprs: what vars from `b` occur in `e`? */
fn free_vars(b: bindings, e: @expr, it: fn(ident)) {
let idents: HashMap<ident, ()> = uint_hash::<()>();
let idents: HashMap<ident, ()> = HashMap();
fn mark_ident(&&i: ident, _fld: ast_fold, b: bindings,
idents: HashMap<ident, ()>) -> ident {
if b.contains_key(i) { idents.insert(i, ()); }

View File

@ -10,7 +10,7 @@ use parse::parse_sess;
use dvec::DVec;
use ast::{matcher, match_tok, match_seq, match_nonterminal, ident};
use ast_util::mk_sp;
use std::map::{HashMap, uint_hash};
use std::map::HashMap;
/* This is an Earley-like parser, without support for in-grammar nonterminals,
only by calling out to the main rust parser for named nonterminals (which it
@ -185,7 +185,7 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
}
}
}
let ret_val = uint_hash::<@named_match>();
let ret_val = HashMap::<uint,@named_match>();
for ms.each() |m| { n_rec(p_s, m, res, ret_val) }
return ret_val;
}

View File

@ -4,7 +4,7 @@ use macro_parser::{named_match, matched_seq, matched_nonterminal};
use codemap::span;
use parse::token::{EOF, INTERPOLATED, IDENT, token, nt_ident,
ident_interner};
use std::map::{HashMap, box_str_hash};
use std::map::HashMap;
export tt_reader, new_tt_reader, dup_tt_reader, tt_next_token;
@ -47,7 +47,7 @@ fn new_tt_reader(sp_diag: span_handler, itr: ident_interner,
mut cur: @{readme: src, mut idx: 0u, dotdotdoted: false,
sep: None, up: tt_frame_up(option::None)},
interpolations: match interp { /* just a convienience */
None => std::map::uint_hash::<@named_match>(),
None => std::map::HashMap::<uint,@named_match>(),
Some(x) => x
},
mut repeat_idx: ~[mut], mut repeat_len: ~[],

View File

@ -2,7 +2,7 @@ use print::pprust::expr_to_str;
use result::Result;
use either::{Either, Left, Right};
use std::map::{HashMap, str_hash};
use std::map::HashMap;
use token::{can_begin_expr, is_ident, is_ident_or_path, is_plain_ident,
INTERPOLATED, special_idents};
use codemap::{span,fss_none};

View File

@ -1,6 +1,6 @@
use util::interner;
use util::interner::interner;
use std::map::{HashMap, str_hash};
use std::map::HashMap;
use std::serialization::{Serializer,
Deserializer,
serialize_uint,
@ -369,7 +369,7 @@ fn mk_fake_ident_interner() -> ident_interner {
* the language and may not appear as identifiers.
*/
fn keyword_table() -> HashMap<~str, ()> {
let keywords = str_hash();
let keywords = HashMap();
for temporary_keyword_table().each_key |word| {
keywords.insert(word, ());
}
@ -384,7 +384,7 @@ fn keyword_table() -> HashMap<~str, ()> {
/// Keywords that may be used as identifiers
fn temporary_keyword_table() -> HashMap<~str, ()> {
let words = str_hash();
let words = HashMap();
let keys = ~[
~"self", ~"static",
];
@ -396,7 +396,7 @@ fn temporary_keyword_table() -> HashMap<~str, ()> {
/// Full keywords. May not appear anywhere else.
fn strict_keyword_table() -> HashMap<~str, ()> {
let words = str_hash();
let words = HashMap();
let keys = ~[
~"as", ~"assert",
~"break",
@ -421,7 +421,7 @@ fn strict_keyword_table() -> HashMap<~str, ()> {
}
fn reserved_keyword_table() -> HashMap<~str, ()> {
let words = str_hash();
let words = HashMap();
let keys = ~[
~"be"
];

View File

@ -167,7 +167,7 @@ fn get_install_prefix_rpath(target_triple: &str) -> Path {
}
fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
let set = map::str_hash::<()>();
let set = map::HashMap();
let mut minimized = ~[];
for rpaths.each |rpath| {
let s = rpath.to_str();

View File

@ -1058,7 +1058,7 @@ fn mk_type_names() -> type_names {
pure fn hash(t: &TypeRef) -> uint { *t as uint }
pure fn eq(a: &TypeRef, b: &TypeRef) -> bool { *a == *b }
@{type_names: std::map::HashMap(),
named_types: std::map::str_hash()}
named_types: std::map::HashMap()}
}
fn type_to_str(names: type_names, ty: TypeRef) -> ~str {

View File

@ -5,7 +5,7 @@ use syntax::{ast, ast_util};
use syntax::attr;
use syntax::visit;
use syntax::codemap::span;
use std::map::{HashMap, int_hash};
use std::map::HashMap;
use syntax::print::pprust;
use filesearch::filesearch;
use common::*;
@ -248,7 +248,7 @@ fn resolve_crate_deps(e: env, cdata: @~[u8]) -> cstore::cnum_map {
debug!("resolving deps of external crate");
// The map from crate numbers in the crate we're resolving to local crate
// numbers
let cnum_map = int_hash::<ast::crate_num>();
let cnum_map = HashMap::<int,ast::crate_num>();
for decoder::get_crate_deps(e.intr, cdata).each |dep| {
let extrn_cnum = dep.cnum;
let cname = dep.name;

View File

@ -4,7 +4,6 @@
use std::map;
use std::map::HashMap;
use syntax::{ast, attr};
use syntax::ast_util::new_def_hash;
use syntax::parse::token::ident_interner;
export cstore;
@ -70,9 +69,9 @@ pure fn p(cstore: cstore) -> cstore_private {
}
fn mk_cstore(intr: ident_interner) -> cstore {
let meta_cache = map::int_hash::<crate_metadata>();
let crate_map = map::int_hash::<ast::crate_num>();
let mod_path_map = new_def_hash();
let meta_cache = map::HashMap::<int,crate_metadata>();
let crate_map = map::HashMap::<int,ast::crate_num>();
let mod_path_map = HashMap();
return private(@{metas: meta_cache,
use_crate_map: crate_map,
mod_path_map: mod_path_map,

View File

@ -1,7 +1,7 @@
// Decoding metadata from a single crate's metadata
use std::{ebml, map};
use std::map::{HashMap, str_hash};
use std::map::HashMap;
use io::WriterUtil;
use dvec::DVec;
use syntax::{ast, ast_util};
@ -969,7 +969,7 @@ fn get_crate_module_paths(intr: ident_interner, cdata: cmd)
// find all module (path, def_ids), which are not
// fowarded path due to renamed import or reexport
let mut res = ~[];
let mods = map::str_hash();
let mods = map::HashMap::<~str,bool>();
do iter_crate_items(intr, cdata) |path, did| {
let m = mod_of_path(path);
if str::is_not_empty(m) {

View File

@ -222,7 +222,7 @@ use syntax::ast_map;
use syntax::codemap::span;
use util::ppaux::{ty_to_str, region_to_str, explain_region,
expr_repr, note_and_explain_region};
use std::map::{int_hash, HashMap, Set};
use std::map::{HashMap, Set};
use std::list;
use std::list::{List, Cons, Nil};
use result::{Result, Ok, Err};
@ -244,7 +244,7 @@ fn check_crate(tcx: ty::ctxt,
method_map: method_map,
last_use_map: last_use_map,
root_map: root_map(),
mutbl_map: int_hash(),
mutbl_map: HashMap(),
mut loaned_paths_same: 0,
mut loaned_paths_imm: 0,
mut stable_paths: 0,

View File

@ -61,7 +61,7 @@ fn check_loans(bccx: borrowck_ctxt,
crate: @ast::crate) {
let clcx = check_loan_ctxt(@{bccx: bccx,
req_maps: req_maps,
reported: int_hash(),
reported: HashMap(),
mut in_ctor: false,
mut declared_purity: ast::impure_fn,
mut fn_args: @~[]});

View File

@ -47,8 +47,8 @@ enum gather_loan_ctxt = @{bccx: borrowck_ctxt,
fn gather_loans(bccx: borrowck_ctxt, crate: @ast::crate) -> req_maps {
let glcx = gather_loan_ctxt(@{bccx: bccx,
req_maps: {req_loan_map: int_hash(),
pure_map: int_hash()},
req_maps: {req_loan_map: HashMap(),
pure_map: HashMap()},
mut item_ub: 0,
mut root_ub: 0});
let v = visit::mk_vt(@{visit_expr: req_loans_in_expr,

View File

@ -36,7 +36,7 @@ fn check_capture_clause(tcx: ty::ctxt,
fn_expr_id: ast::node_id,
cap_clause: ast::capture_clause) {
let freevars = freevars::get_freevars(tcx, fn_expr_id);
let seen_defs = map::int_hash();
let seen_defs = map::HashMap();
for (*cap_clause).each |cap_item| {
let cap_def = tcx.def_map.get(cap_item.id);
@ -62,7 +62,7 @@ fn compute_capture_vars(tcx: ty::ctxt,
fn_proto: ty::fn_proto,
cap_clause: ast::capture_clause) -> ~[capture_var] {
let freevars = freevars::get_freevars(tcx, fn_expr_id);
let cap_map = map::int_hash();
let cap_map = map::HashMap();
// first add entries for anything explicitly named in the cap clause

View File

@ -32,7 +32,7 @@ type freevar_map = HashMap<ast::node_id, freevar_info>;
// in order to start the search.
fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk)
-> freevar_info {
let seen = int_hash();
let seen = HashMap();
let refs = @mut ~[];
fn ignore_item(_i: @ast::item, &&_depth: int, _v: visit::vt<int>) { }
@ -87,7 +87,7 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk)
// one pass. This could be improved upon if it turns out to matter.
fn annotate_freevars(def_map: resolve::DefMap, crate: @ast::crate) ->
freevar_map {
let freevars = int_hash();
let freevars = HashMap();
let walk_fn = fn@(_fk: visit::fn_kind, _decl: ast::fn_decl,
blk: ast::blk, _sp: span, nid: ast::node_id) {

View File

@ -19,7 +19,7 @@ use syntax::ast_util::{local_def};
use syntax::visit::{default_simple_visitor, mk_simple_visitor};
use syntax::visit::{visit_crate, visit_item};
use std::map::{HashMap, str_hash};
use std::map::HashMap;
use str_eq = str::eq;
struct LanguageItems {
@ -84,7 +84,7 @@ fn LanguageItemCollector(crate: @crate, session: session,
items: &r/LanguageItems)
-> LanguageItemCollector/&r {
let item_refs = str_hash();
let item_refs = HashMap();
item_refs.insert(~"const", &mut items.const_trait);
item_refs.insert(~"copy", &mut items.copy_trait);

View File

@ -4,7 +4,7 @@ use middle::ty;
use syntax::{ast, ast_util, visit};
use syntax::attr;
use syntax::codemap::span;
use std::map::{Map,HashMap,int_hash,hash_from_strs};
use std::map::{Map,HashMap};
use std::smallintmap::{Map,SmallIntMap};
use io::WriterUtil;
use util::ppaux::{ty_to_str};
@ -198,7 +198,7 @@ fn get_lint_dict() -> lint_dict {
default: warn}),
*/
];
hash_from_strs(v)
std::map::hash_from_vec(v)
}
// This is a highly not-optimal set of data structure decisions.
@ -215,7 +215,7 @@ type lint_settings = {
fn mk_lint_settings() -> lint_settings {
{default_settings: std::smallintmap::mk(),
settings_map: int_hash()}
settings_map: HashMap()}
}
fn get_lint_level(modes: lint_modes, lint: lint) -> level {

View File

@ -101,7 +101,7 @@
*/
use dvec::DVec;
use std::map::{HashMap, int_hash, str_hash, uint_hash};
use std::map::HashMap;
use syntax::{visit, ast_util};
use syntax::print::pprust::{expr_to_str};
use visit::vt;
@ -187,7 +187,7 @@ fn check_crate(tcx: ty::ctxt,
.. *visit::default_visitor()
});
let last_use_map = int_hash();
let last_use_map = HashMap();
let initial_maps = @IrMaps(tcx, method_map, last_use_map);
visit::visit_crate(*crate, initial_maps, visitor);
tcx.sess.abort_if_errors();
@ -290,10 +290,10 @@ fn IrMaps(tcx: ty::ctxt, method_map: typeck::method_map,
last_use_map: last_use_map,
num_live_nodes: 0u,
num_vars: 0u,
live_node_map: int_hash(),
variable_map: int_hash(),
capture_map: int_hash(),
field_map: uint_hash(),
live_node_map: HashMap(),
variable_map: HashMap(),
capture_map: HashMap(),
field_map: HashMap(),
var_kinds: ~[],
lnks: ~[]
}

View File

@ -14,7 +14,7 @@ type PatIdMap = std::map::HashMap<ident, node_id>;
// This is used because same-named variables in alternative patterns need to
// use the node_id of their namesake in the first pattern.
fn pat_id_map(dm: resolve::DefMap, pat: @pat) -> PatIdMap {
let map = std::map::uint_hash();
let map = std::map::HashMap();
do pat_bindings(dm, pat) |_bm, p_id, _s, n| {
map.insert(path_to_ident(n), p_id);
};

View File

@ -12,7 +12,6 @@ use middle::ty;
use syntax::{ast, visit};
use syntax::codemap::span;
use syntax::print::pprust;
use syntax::ast_util::new_def_hash;
use syntax::ast_map;
use dvec::DVec;
use metadata::csearch;
@ -20,7 +19,7 @@ use ty::{region_variance, rv_covariant, rv_invariant, rv_contravariant};
use std::list;
use std::list::list;
use std::map::{HashMap, int_hash};
use std::map::HashMap;
type parent = Option<ast::node_id>;
@ -333,8 +332,8 @@ fn resolve_crate(sess: session, def_map: resolve::DefMap,
crate: @ast::crate) -> region_map {
let cx: ctxt = ctxt {sess: sess,
def_map: def_map,
region_map: int_hash(),
root_exprs: int_hash(),
region_map: HashMap(),
root_exprs: HashMap(),
parent: None};
let visitor = visit::mk_vt(@{
visit_block: resolve_block,
@ -762,8 +761,8 @@ fn determine_rp_in_crate(sess: session,
let cx = determine_rp_ctxt_(@{sess: sess,
ast_map: ast_map,
def_map: def_map,
region_paramd_items: int_hash(),
dep_map: int_hash(),
region_paramd_items: HashMap(),
dep_map: HashMap(),
worklist: DVec(),
mut item_id: 0,
mut anon_implies_rp: false,

View File

@ -42,7 +42,7 @@ use syntax::ast::{ty_u16, ty_u32, ty_u64, ty_u8, ty_uint, type_value_ns};
use syntax::ast::{variant, view_item, view_item_export, view_item_import};
use syntax::ast::{view_item_use, view_path_glob, view_path_list};
use syntax::ast::{view_path_simple, visibility, anonymous, named};
use syntax::ast_util::{def_id_of_def, dummy_sp, local_def, new_def_hash};
use syntax::ast_util::{def_id_of_def, dummy_sp, local_def};
use syntax::ast_util::{path_to_ident, walk_pat, trait_method_to_ty_method};
use syntax::attr::{attr_metas, contains_name};
use syntax::print::pprust::{pat_to_str, path_to_str};
@ -60,7 +60,7 @@ use vec::pop;
use syntax::parse::token::ident_interner;
use std::list::{Cons, List, Nil};
use std::map::{HashMap, int_hash, uint_hash};
use std::map::HashMap;
use str_eq = str::eq;
// Definition mapping
@ -458,7 +458,7 @@ fn Module(parent_link: ParentLink, def_id: Option<def_id>) -> Module {
def_id: def_id,
children: atom_hashmap(),
imports: DVec(),
anonymous_children: int_hash(),
anonymous_children: HashMap(),
exported_names: atom_hashmap(),
import_resolutions: atom_hashmap(),
glob_count: 0u,
@ -701,8 +701,8 @@ fn Resolver(session: session, lang_items: LanguageItems,
unused_import_lint_level: unused_import_lint_level(session),
trait_info: new_def_hash(),
structs: new_def_hash(),
trait_info: HashMap(),
structs: HashMap(),
unresolved_imports: 0u,
@ -720,10 +720,10 @@ fn Resolver(session: session, lang_items: LanguageItems,
namespaces: ~[ ModuleNS, TypeNS, ValueNS ],
def_map: int_hash(),
export_map: int_hash(),
export_map2: int_hash(),
trait_map: @int_hash(),
def_map: HashMap(),
export_map: HashMap(),
export_map2: HashMap(),
trait_map: @HashMap(),
intr: session.intr()
};
@ -1510,7 +1510,7 @@ impl Resolver {
* crate.
*/
fn build_reduced_graph_for_external_crate(root: @Module) {
let modules = new_def_hash();
let modules = HashMap();
// Create all the items reachable by paths.
for each_path(self.session.cstore, get(root.def_id).crate)
@ -3664,7 +3664,7 @@ impl Resolver {
}
fn binding_mode_map(pat: @pat) -> BindingMap {
let result = uint_hash();
let result = HashMap();
do pat_bindings(self.def_map, pat) |binding_mode, _id, sp, path| {
let ident = path_to_ident(path);
result.insert(ident,

View File

@ -1096,7 +1096,7 @@ fn trans_alt_inner(scope_cx: block,
// to an alloca() that will be the value for that local variable.
// Note that we use the names because each binding will have many ids
// from the various alternatives.
let bindings_map = std::map::uint_hash();
let bindings_map = std::map::HashMap();
do pat_bindings(tcx.def_map, arm.pats[0]) |bm, p_id, _s, path| {
let ident = path_to_ident(path);
let variable_ty = node_id_type(bcx, p_id);

View File

@ -16,7 +16,6 @@
use libc::{c_uint, c_ulonglong};
use std::{map, time, list};
use std::map::HashMap;
use std::map::{int_hash, str_hash};
use driver::session;
use session::session;
use syntax::attr;
@ -1407,9 +1406,9 @@ fn new_fn_ctxt_w_id(ccx: @crate_ctxt, path: path,
mut llself: None,
mut personality: None,
mut loop_ret: None,
llargs: int_hash::<local_val>(),
lllocals: int_hash::<local_val>(),
llupvars: int_hash::<ValueRef>(),
llargs: HashMap::<int,local_val>(),
lllocals: HashMap::<int,local_val>(),
llupvars: HashMap::<int,ValueRef>(),
id: id,
param_substs: param_substs,
span: sp,
@ -2309,7 +2308,7 @@ fn declare_intrinsics(llmod: ModuleRef) -> HashMap<~str, ValueRef> {
let frameaddress = decl_cdecl_fn(llmod, ~"llvm.frameaddress",
T_fn(T_frameaddress_args,
T_ptr(T_i8())));
let intrinsics = str_hash::<ValueRef>();
let intrinsics = HashMap::<~str,ValueRef>();
intrinsics.insert(~"llvm.gcroot", gcroot);
intrinsics.insert(~"llvm.gcread", gcread);
intrinsics.insert(~"llvm.memmove.p0i8.p0i8.i32", memmove32);
@ -2624,35 +2623,35 @@ fn trans_crate(sess: session::session,
llmod: llmod,
td: td,
tn: tn,
externs: str_hash::<ValueRef>(),
externs: HashMap::<~str,ValueRef>(),
intrinsics: intrinsics,
item_vals: int_hash::<ValueRef>(),
item_vals: HashMap::<int,ValueRef>(),
exp_map: emap,
exp_map2: emap2,
reachable: reachable,
item_symbols: int_hash::<~str>(),
item_symbols: HashMap::<int,~str>(),
mut main_fn: None::<ValueRef>,
link_meta: link_meta,
enum_sizes: ty::new_ty_hash(),
discrims: ast_util::new_def_hash::<ValueRef>(),
discrim_symbols: int_hash::<~str>(),
discrims: HashMap(),
discrim_symbols: HashMap::<int,~str>(),
tydescs: ty::new_ty_hash(),
mut finished_tydescs: false,
external: ast_util::new_def_hash(),
monomorphized: map::HashMap(),
monomorphizing: ast_util::new_def_hash(),
type_use_cache: ast_util::new_def_hash(),
external: HashMap(),
monomorphized: HashMap(),
monomorphizing: HashMap(),
type_use_cache: HashMap(),
vtables: map::HashMap(),
const_cstr_cache: map::str_hash(),
const_globals: int_hash::<ValueRef>(),
module_data: str_hash::<ValueRef>(),
const_cstr_cache: HashMap(),
const_globals: HashMap::<int,ValueRef>(),
module_data: HashMap::<~str,ValueRef>(),
lltypes: ty::new_ty_hash(),
names: new_namegen(sess.parse_sess.interner),
next_addrspace: new_addrspace_gen(),
symbol_hasher: symbol_hasher,
type_hashcodes: ty::new_ty_hash(),
type_short_names: ty::new_ty_hash(),
all_llvm_symbols: str_hash::<()>(),
all_llvm_symbols: HashMap::<~str,()>(),
tcx: tcx,
maps: maps,
stats:
@ -2665,12 +2664,12 @@ fn trans_crate(sess: session::session,
mut n_inlines: 0u,
mut n_closures: 0u,
llvm_insn_ctxt: @mut ~[],
llvm_insns: str_hash(),
llvm_insns: HashMap(),
fn_times: @mut ~[]},
upcalls:
upcall::declare_upcalls(targ_cfg, tn, tydesc_type,
llmod),
rtcalls: str_hash::<ast::def_id>(),
rtcalls: HashMap::<~str,ast::def_id>(),
tydesc_type: tydesc_type,
int_type: int_type,
float_type: float_type,
@ -2681,7 +2680,7 @@ fn trans_crate(sess: session::session,
crate_map: crate_map,
mut uses_gc: false,
dbg_cx: dbg_cx,
class_ctors: int_hash::<ast::def_id>(),
class_ctors: HashMap::<int,ast::def_id>(),
mut do_not_commit_warning_issued: false};

View File

@ -1,4 +1,4 @@
use std::map::{HashMap, str_hash};
use std::map::HashMap;
use libc::{c_uint, c_int};
use lib::llvm::llvm;
use syntax::codemap;
@ -24,7 +24,7 @@ fn count_insn(cx: block, category: &str) {
// Build version of path with cycles removed.
// Pass 1: scan table mapping str -> rightmost pos.
let mm = str_hash();
let mm = HashMap();
let len = vec::len(*v);
let mut i = 0u;
while i < len {

View File

@ -91,7 +91,7 @@ type debug_ctxt = {
};
fn mk_ctxt(crate: ~str, intr: ident_interner) -> debug_ctxt {
{llmetadata: map::int_hash(),
{llmetadata: map::HashMap(),
names: new_namegen(intr),
crate_file: crate}
}

View File

@ -24,7 +24,7 @@ type ctx = {exp_map: resolve::ExportMap,
fn find_reachable(crate_mod: _mod, exp_map: resolve::ExportMap,
tcx: ty::ctxt, method_map: typeck::method_map) -> map {
let rmap = std::map::int_hash();
let rmap = std::map::HashMap();
let cx = {exp_map: exp_map, tcx: tcx, method_map: method_map, rmap: rmap};
traverse_public_mod(cx, crate_mod);
traverse_all_resources_and_impls(cx, crate_mod);

View File

@ -1,4 +1,4 @@
use std::map::{HashMap,str_hash};
use std::map::HashMap;
use driver::session::session;
use lib::llvm::{TypeRef, ValueRef};
use syntax::ast;

View File

@ -11,7 +11,7 @@ use back::abi;
use middle::ty;
use middle::ty::field;
use syntax::ast;
use syntax::ast_util::{dummy_sp, new_def_hash};
use syntax::ast_util::dummy_sp;
use syntax::util::interner;
use util::ppaux::ty_to_str;
use syntax::codemap::span;

View File

@ -8,7 +8,7 @@ use driver::session;
use session::session;
use syntax::{ast, ast_map};
use syntax::ast_util;
use syntax::ast_util::{is_local, local_def, new_def_hash};
use syntax::ast_util::{is_local, local_def};
use syntax::codemap::span;
use metadata::csearch;
use util::ppaux::{region_to_str, explain_region, vstore_to_str,
@ -856,23 +856,23 @@ fn mk_ctxt(s: session::session,
region_map: region_map,
region_paramd_items: region_paramd_items,
node_types: @smallintmap::mk(),
node_type_substs: map::int_hash(),
node_type_substs: map::HashMap(),
items: amap,
intrinsic_defs: map::uint_hash(),
intrinsic_defs: map::HashMap(),
freevars: freevars,
tcache: ast_util::new_def_hash(),
tcache: HashMap(),
rcache: mk_rcache(),
ccache: ast_util::new_def_hash(),
ccache: HashMap(),
short_names_cache: new_ty_hash(),
needs_drop_cache: new_ty_hash(),
needs_unwind_cleanup_cache: new_ty_hash(),
kind_cache: new_ty_hash(),
ast_ty_to_ty_cache: map::HashMap(),
enum_var_cache: new_def_hash(),
trait_method_cache: new_def_hash(),
ty_param_bounds: map::int_hash(),
inferred_modes: map::int_hash(),
adjustments: map::int_hash(),
ast_ty_to_ty_cache: HashMap(),
enum_var_cache: HashMap(),
trait_method_cache: HashMap(),
ty_param_bounds: HashMap(),
inferred_modes: HashMap(),
adjustments: HashMap(),
normalized_cache: new_ty_hash(),
lang_items: move lang_items}
}

View File

@ -55,7 +55,7 @@ use middle::ty::{arg, field, node_type_table, mk_nil, ty_param_bounds_and_ty};
use middle::ty::{vstore_uniq};
use std::smallintmap;
use std::map;
use std::map::{HashMap, int_hash};
use std::map::HashMap;
use std::serialization::{serialize_uint, deserialize_uint};
use syntax::print::pprust::*;
use util::ppaux::{ty_to_str, tys_to_str, region_to_str,
@ -329,10 +329,10 @@ fn check_crate(tcx: ty::ctxt,
-> (method_map, vtable_map) {
let ccx = @crate_ctxt_({trait_map: trait_map,
method_map: std::map::int_hash(),
vtable_map: std::map::int_hash(),
method_map: std::map::HashMap(),
vtable_map: std::map::HashMap(),
coherence_info: @coherence::CoherenceInfo(),
provided_methods_map: std::map::int_hash(),
provided_methods_map: std::map::HashMap(),
tcx: tcx});
collect::collect_item_types(ccx, crate);
coherence::check_coherence(ccx, crate);

View File

@ -79,7 +79,7 @@ use result::{Result, Ok, Err};
use syntax::print::pprust;
use syntax::parse::token::special_idents;
use std::map::{str_hash, uint_hash};
use std::map::HashMap;
type self_info = {
self_ty: ty::t,
@ -141,10 +141,10 @@ struct fn_ctxt {
fn blank_inherited(ccx: @crate_ctxt) -> @inherited {
@inherited {
infcx: infer::new_infer_ctxt(ccx.tcx),
locals: int_hash(),
node_types: map::int_hash(),
node_type_substs: map::int_hash(),
adjustments: map::int_hash()
locals: HashMap(),
node_types: map::HashMap(),
node_type_substs: map::HashMap(),
adjustments: map::HashMap()
}
}
@ -425,7 +425,7 @@ fn check_method(ccx: @crate_ctxt, method: @ast::method,
fn check_no_duplicate_fields(tcx: ty::ctxt, fields:
~[(ast::ident, span)]) {
let field_names = uint_hash();
let field_names = HashMap();
for fields.each |p| {
let (id, sp) = p;
@ -1963,7 +1963,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
// Look up the class fields and build up a map.
let class_fields = ty::lookup_class_fields(tcx, class_id);
let class_field_map = uint_hash();
let class_field_map = HashMap();
let mut fields_found = 0;
for class_fields.each |field| {
// XXX: Check visibility here.

View File

@ -349,13 +349,13 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
}
// Index the class fields.
let field_map = std::map::uint_hash();
let field_map = std::map::HashMap();
for class_fields.eachi |i, class_field| {
field_map.insert(class_field.ident, i);
}
// Typecheck each field.
let found_fields = std::map::uint_hash();
let found_fields = std::map::HashMap();
for fields.each |field| {
match field_map.find(field.ident) {
Some(index) => {

View File

@ -76,7 +76,7 @@ use syntax::ast::{def_id, sty_by_ref, sty_value, sty_region, sty_box,
m_const, m_mutbl, m_imm};
use syntax::ast_map;
use syntax::ast_map::node_id_to_str;
use syntax::ast_util::{dummy_sp, new_def_hash};
use syntax::ast_util::dummy_sp;
use dvec::DVec;
fn lookup(
@ -98,7 +98,7 @@ fn lookup(
callee_id: callee_id,
m_name: m_name,
supplied_tps: supplied_tps,
impl_dups: new_def_hash(),
impl_dups: HashMap(),
inherent_candidates: DVec(),
extension_candidates: DVec()
};

View File

@ -1,7 +1,6 @@
use check::{fn_ctxt, impl_self_ty};
use infer::{resolve_type, resolve_and_force_all_but_regions,
fixup_err_to_str};
use ast_util::new_def_hash;
use syntax::print::pprust;
use result::{Result, Ok, Err};
use util::common::indenter;
@ -177,7 +176,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
_ => {
let mut found = ~[];
let mut impls_seen = new_def_hash();
let mut impls_seen = HashMap();
match fcx.ccx.coherence_info.extension_methods.find(trait_id) {
None => {

View File

@ -23,7 +23,7 @@ use syntax::ast::{item_foreign_mod, item_impl, item_mac, item_mod};
use syntax::ast::{item_trait, item_ty, local_crate, method, node_id};
use syntax::ast::{trait_ref};
use syntax::ast_map::node_item;
use syntax::ast_util::{def_id_of_def, dummy_sp, new_def_hash};
use syntax::ast_util::{def_id_of_def, dummy_sp};
use syntax::codemap::span;
use syntax::visit::{default_simple_visitor, default_visitor};
use syntax::visit::{mk_simple_visitor, mk_vt, visit_crate, visit_item};
@ -32,7 +32,7 @@ use util::ppaux::ty_to_str;
use dvec::DVec;
use result::Ok;
use std::map::{HashMap, int_hash};
use std::map::HashMap;
use uint::range;
use vec::{len, push};
@ -130,8 +130,8 @@ struct CoherenceInfo {
fn CoherenceInfo() -> CoherenceInfo {
CoherenceInfo {
inherent_methods: new_def_hash(),
extension_methods: new_def_hash()
inherent_methods: HashMap(),
extension_methods: HashMap()
}
}
@ -140,8 +140,8 @@ fn CoherenceChecker(crate_context: @crate_ctxt) -> CoherenceChecker {
crate_context: crate_context,
inference_context: new_infer_ctxt(crate_context.tcx),
base_type_def_ids: new_def_hash(),
privileged_implementations: int_hash()
base_type_def_ids: HashMap(),
privileged_implementations: HashMap()
}
}
@ -728,7 +728,7 @@ impl CoherenceChecker {
}
fn add_external_crates() {
let impls_seen = new_def_hash();
let impls_seen = HashMap();
let crate_store = self.crate_context.tcx.sess.cstore;
do iter_crate_data(crate_store) |crate_number, _crate_metadata| {

View File

@ -308,7 +308,7 @@ because `&x` was created alone, but is relatable to `&A`.
use dvec::DVec;
use result::Result;
use result::{Ok, Err};
use std::map::{HashMap, uint_hash};
use std::map::HashMap;
use std::cell::{Cell, empty_cell};
use std::list::{List, Nil, Cons};
@ -1188,7 +1188,7 @@ impl RegionVarBindings {
fn collect_concrete_regions(graph: &Graph,
orig_node_idx: RegionVid,
dir: Direction) -> ~[SpannedRegion] {
let set = uint_hash();
let set = HashMap();
let mut stack = ~[orig_node_idx];
set.insert(*orig_node_idx, ());
let mut result = ~[];

View File

@ -157,9 +157,9 @@ fn main(args: ~[~str]) {
let rng = rand::seeded_rng(copy seed);
let mut results = empty_results();
int_benchmarks::<map::HashMap<uint, uint>>(
map::uint_hash, rng, num_keys, &mut results);
map::HashMap, rng, num_keys, &mut results);
str_benchmarks::<map::HashMap<~str, uint>>(
map::str_hash, rng, num_keys, &mut results);
map::HashMap, rng, num_keys, &mut results);
write_results("libstd::map::hashmap", &results);
}

View File

@ -94,7 +94,7 @@ fn windows_with_carry(bb: &[u8], nn: uint,
fn make_sequence_processor(sz: uint, from_parent: pipes::Port<~[u8]>,
to_parent: pipes::Chan<~str>) {
let freqs: HashMap<~[u8], uint> = map::bytes_hash();
let freqs: HashMap<~[u8], uint> = map::HashMap();
let mut carry: ~[u8] = ~[];
let mut total: uint = 0u;

View File

@ -91,7 +91,7 @@ fn windows_with_carry(bb: &[u8], nn: uint,
fn make_sequence_processor(sz: uint, from_parent: comm::Port<~[u8]>,
to_parent: comm::Chan<~str>) {
let freqs: HashMap<~[u8], uint> = map::bytes_hash();
let freqs: HashMap<~[u8], uint> = map::HashMap();
let mut carry: ~[u8] = ~[];
let mut total: uint = 0u;

View File

@ -120,7 +120,7 @@ fn writer(path: ~str, writech: comm::Chan<comm::Chan<line>>, size: uint)
};
cout.write_line(~"P4");
cout.write_line(fmt!("%u %u", size, size));
let lines: HashMap<uint, ~[u8]> = std::map::uint_hash();
let lines: HashMap<uint, ~[u8]> = HashMap();
let mut done = 0_u;
let mut i = 0_u;
while i < size {

View File

@ -6,7 +6,7 @@ use std::map::Map;
// Test that trait types printed in error msgs include the type arguments.
fn main() {
let x: Map<~str,~str> = map::str_hash::<~str>() as Map::<~str,~str>;
let x: Map<~str,~str> = map::HashMap::<~str,~str>() as Map::<~str,~str>;
let y: Map<uint,~str> = x;
//~^ ERROR mismatched types: expected `@std::map::Map<uint,~str>`
}

View File

@ -35,7 +35,7 @@ mod map_reduce {
}
fn map_task(ctrl: Chan<ctrl_proto>, input: ~str) {
let intermediates = map::str_hash();
let intermediates = map::HashMap();
fn emit(im: map::HashMap<~str, int>, ctrl: Chan<ctrl_proto>, key: ~str,
val: ~str) {
@ -66,7 +66,7 @@ mod map_reduce {
let mut reducers: map::HashMap<~str, int>;
reducers = map::str_hash();
reducers = map::HashMap();
start_mappers(Chan(ctrl), inputs);

View File

@ -3,7 +3,7 @@ use std::map;
use std::map::HashMap;
fn main() {
let m = map::bytes_hash();
let m = map::HashMap();
m.insert(str::to_bytes(~"foo"), str::to_bytes(~"bar"));
log(error, m);
}

View File

@ -6,11 +6,11 @@ extern mod std;
use req::*;
use std::map::*;
use std::map::str_hash;
use std::map::HashMap;
fn main() {
let v = ~[@~"hi"];
let m: req::header_map = str_hash();
let m: req::header_map = HashMap();
m.insert(~"METHOD", @dvec::from_vec(v));
request::<int>(m);
}