diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-03-14 12:07:23 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-03-14 18:19:08 -0700 |
| commit | 3864d6d845f6bf9493698606bba2220daede4738 (patch) | |
| tree | 206d35d98526bec1424c87f4c77af141e99bec4b | |
| parent | 383a80199351c6b9f9f4834242231c8586fb2ab6 (diff) | |
std: Rename the hashmap constructors to conform to new standards
Instead of using the new_ prefix just name them after their type
43 files changed, 140 insertions, 143 deletions
diff --git a/src/cargo/cargo.rs b/src/cargo/cargo.rs index 9a19cfc0220..67a0230a7a0 100644 --- a/src/cargo/cargo.rs +++ b/src/cargo/cargo.rs @@ -387,7 +387,7 @@ fn configure(opts: options) -> cargo { result::err(e) { fail e } }; - let sources = map::new_str_hash::<source>(); + let sources = map::str_hash::<source>(); try_parse_sources(path::connect(syscargo, "sources.json"), sources); try_parse_sources(path::connect(syscargo, "local-sources.json"), sources); let c = { diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index 364eb16408c..40c44da8b45 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -7,8 +7,6 @@ import core::option; import option::{some, none}; export doc; - -export new_doc; export doc_at; export maybe_get_doc; export get_doc; @@ -64,7 +62,7 @@ fn vuint_at(data: [u8], start: uint) -> {val: uint, next: uint} { } else { #error("vint too big"); fail; } } -fn new_doc(data: @[u8]) -> doc { +fn doc(data: @[u8]) -> doc { ret {data: data, start: 0u, end: vec::len::<u8>(*data)}; } @@ -575,7 +573,7 @@ fn test_option_int() { let mbuf = io::mem_buffer(); let ebml_w = ebml::writer(io::mem_buffer_writer(mbuf)); serialize_0(ebml_w, v); - let ebml_doc = ebml::new_doc(@io::mem_buffer_buf(mbuf)); + let ebml_doc = ebml::doc(@io::mem_buffer_buf(mbuf)); let deser = ebml_deserializer(ebml_doc); let v1 = deserialize_0(deser); #debug["v1 == %?", v1]; diff --git a/src/libstd/json.rs b/src/libstd/json.rs index b5f526da2ed..216c881ab40 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -407,7 +407,7 @@ impl parser for parser { self.bump(); self.parse_whitespace(); - let values = map::new_str_hash(); + let values = map::str_hash(); if self.ch == '}' { self.bump(); @@ -501,7 +501,7 @@ fn eq(value0: json, value1: json) -> bool { #[cfg(test)] mod tests { fn mk_dict(items: [(str, json)]) -> json { - let d = map::new_str_hash(); + let d = map::str_hash(); vec::iter(items) { |item| let (key, value) = item; diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 53eb04fe070..f5302082b8d 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -1,8 +1,8 @@ #[doc = "A map type"]; import chained::hashmap; -export hashmap, hashfn, eqfn, set, map, chained, new_hashmap, new_str_hash; -export new_bytes_hash, new_int_hash, new_uint_hash, set_add; +export hashmap, hashfn, eqfn, set, map, chained, hashmap, str_hash; +export bytes_hash, int_hash, uint_hash, set_add; #[doc = " A function that returns a hash of a value @@ -289,7 +289,7 @@ mod chained { } /* -Function: new_hashmap +Function: hashmap Construct a hashmap. @@ -298,33 +298,33 @@ Parameters: hasher - The hash function for key type K eqer - The equality function for key type K */ -fn new_hashmap<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>) +fn hashmap<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>) -> hashmap<K, V> { chained::mk(hasher, eqer) } #[doc = "Construct a hashmap for string keys"] -fn new_str_hash<V: copy>() -> hashmap<str, V> { - ret new_hashmap(str::hash, str::eq); +fn str_hash<V: copy>() -> hashmap<str, V> { + ret hashmap(str::hash, str::eq); } #[doc = "Construct a hashmap for byte string keys"] -fn new_bytes_hash<V: copy>() -> hashmap<[u8], V> { - ret new_hashmap(vec::u8::hash, vec::u8::eq); +fn bytes_hash<V: copy>() -> hashmap<[u8], V> { + ret hashmap(vec::u8::hash, vec::u8::eq); } #[doc = "Construct a hashmap for int keys"] -fn new_int_hash<V: copy>() -> hashmap<int, V> { +fn int_hash<V: copy>() -> hashmap<int, V> { fn hash_int(&&x: int) -> uint { int::hash(x) } fn eq_int(&&a: int, &&b: int) -> bool { ret a == b; } - ret new_hashmap(hash_int, eq_int); + ret hashmap(hash_int, eq_int); } #[doc = "Construct a hashmap for uint keys"] -fn new_uint_hash<V: copy>() -> hashmap<uint, V> { +fn uint_hash<V: copy>() -> hashmap<uint, V> { fn hash_uint(&&x: uint) -> uint { uint::hash(x) } fn eq_uint(&&a: uint, &&b: uint) -> bool { ret a == b; } - ret new_hashmap(hash_uint, eq_uint); + ret hashmap(hash_uint, eq_uint); } #[doc = " @@ -346,7 +346,7 @@ mod tests { let eqer_str: map::eqfn<str> = str::eq; #debug("uint -> uint"); let hm_uu: map::hashmap<uint, uint> = - map::new_hashmap::<uint, uint>(hasher_uint, eqer_uint); + map::hashmap::<uint, uint>(hasher_uint, eqer_uint); assert (hm_uu.insert(10u, 12u)); assert (hm_uu.insert(11u, 13u)); assert (hm_uu.insert(12u, 14u)); @@ -362,7 +362,7 @@ mod tests { let twelve: str = "twelve"; #debug("str -> uint"); let hm_su: map::hashmap<str, uint> = - map::new_hashmap::<str, uint>(hasher_str, eqer_str); + map::hashmap::<str, uint>(hasher_str, eqer_str); assert (hm_su.insert("ten", 12u)); assert (hm_su.insert(eleven, 13u)); assert (hm_su.insert("twelve", 14u)); @@ -376,7 +376,7 @@ mod tests { assert (hm_su.get("twelve") == 12u); #debug("uint -> str"); let hm_us: map::hashmap<uint, str> = - map::new_hashmap::<uint, str>(hasher_uint, eqer_uint); + map::hashmap::<uint, str>(hasher_uint, eqer_uint); assert (hm_us.insert(10u, "twelve")); assert (hm_us.insert(11u, "thirteen")); assert (hm_us.insert(12u, "fourteen")); @@ -389,7 +389,7 @@ mod tests { assert (str::eq(hm_us.get(12u), "twelve")); #debug("str -> str"); let hm_ss: map::hashmap<str, str> = - map::new_hashmap::<str, str>(hasher_str, eqer_str); + map::hashmap::<str, str>(hasher_str, eqer_str); assert (hm_ss.insert(ten, "twelve")); assert (hm_ss.insert(eleven, "thirteen")); assert (hm_ss.insert(twelve, "fourteen")); @@ -417,7 +417,7 @@ mod tests { let hasher_uint: map::hashfn<uint> = uint_id; let eqer_uint: map::eqfn<uint> = eq_uint; let hm_uu: map::hashmap<uint, uint> = - map::new_hashmap::<uint, uint>(hasher_uint, eqer_uint); + map::hashmap::<uint, uint>(hasher_uint, eqer_uint); let i: uint = 0u; while i < num_to_insert { assert (hm_uu.insert(i, i * i)); @@ -444,7 +444,7 @@ mod tests { let hasher_str: map::hashfn<str> = str::hash; let eqer_str: map::eqfn<str> = str::eq; let hm_ss: map::hashmap<str, str> = - map::new_hashmap::<str, str>(hasher_str, eqer_str); + map::hashmap::<str, str>(hasher_str, eqer_str); i = 0u; while i < num_to_insert { assert hm_ss.insert(uint::to_str(i, 2u), uint::to_str(i * i, 2u)); @@ -497,7 +497,7 @@ mod tests { let hasher: map::hashfn<uint> = hash; let eqer: map::eqfn<uint> = eq; let hm: map::hashmap<uint, uint> = - map::new_hashmap::<uint, uint>(hasher, eqer); + map::hashmap::<uint, uint>(hasher, eqer); let i: uint = 0u; while i < num_to_insert { assert (hm.insert(i, i * i)); @@ -560,7 +560,7 @@ mod tests { #[test] fn test_contains_key() { let key = "k"; - let map = map::new_hashmap::<str, str>(str::hash, str::eq); + let map = map::hashmap::<str, str>(str::hash, str::eq); assert (!map.contains_key(key)); map.insert(key, "val"); assert (map.contains_key(key)); @@ -569,7 +569,7 @@ mod tests { #[test] fn test_find() { let key = "k"; - let map = map::new_hashmap::<str, str>(str::hash, str::eq); + let map = map::hashmap::<str, str>(str::hash, str::eq); assert (option::is_none(map.find(key))); map.insert(key, "val"); assert (option::get(map.find(key)) == "val"); diff --git a/src/libstd/uv.rs b/src/libstd/uv.rs index 026a9edb6a8..f6f42de148a 100644 --- a/src/libstd/uv.rs +++ b/src/libstd/uv.rs @@ -131,17 +131,17 @@ fn loop_new() -> uv_loop unsafe { // all state goes here let handles: map::hashmap<[u8], *libc::c_void> = - map::new_bytes_hash(); + map::bytes_hash(); let id_to_handle: map::hashmap<[u8], uv_handle> = - map::new_bytes_hash(); + map::bytes_hash(); let after_cbs: map::hashmap<[u8], fn~(uv_handle)> = - map::new_bytes_hash(); + map::bytes_hash(); let close_callbacks: map::hashmap<[u8], fn~()> = - map::new_bytes_hash(); + map::bytes_hash(); let async_cbs: map::hashmap<[u8], fn~(uv_handle)> = - map::new_bytes_hash(); + map::bytes_hash(); let timer_cbs: map::hashmap<[u8], fn~(uv_handle)> = - map::new_bytes_hash(); + map::bytes_hash(); // the main loop that this task blocks on. // should have the same lifetime as the C libuv diff --git a/src/rustc/back/rpath.rs b/src/rustc/back/rpath.rs index b121d69723b..324b2599b55 100644 --- a/src/rustc/back/rpath.rs +++ b/src/rustc/back/rpath.rs @@ -178,7 +178,7 @@ fn get_install_prefix_rpath(cwd: path::path, target_triple: str) -> str { } fn minimize_rpaths(rpaths: [str]) -> [str] { - let set = map::new_str_hash::<()>(); + let set = map::str_hash::<()>(); let minimized = []; for rpath in rpaths { if !set.contains_key(rpath) { diff --git a/src/rustc/front/attr.rs b/src/rustc/front/attr.rs index 9bd817fb36a..fd74034fd28 100644 --- a/src/rustc/front/attr.rs +++ b/src/rustc/front/attr.rs @@ -220,7 +220,7 @@ fn remove_meta_items_by_name(items: [@ast::meta_item], name: str) -> } fn require_unique_names(sess: session, metas: [@ast::meta_item]) { - let map = map::new_str_hash(); + let map = map::str_hash(); for meta: @ast::meta_item in metas { let name = get_meta_item_name(meta); if map.contains_key(name) { diff --git a/src/rustc/lib/llvm.rs b/src/rustc/lib/llvm.rs index 3dde486d85c..d3b8c92bd17 100644 --- a/src/rustc/lib/llvm.rs +++ b/src/rustc/lib/llvm.rs @@ -940,8 +940,8 @@ fn name_has_type(tn: type_names, s: str) -> option<TypeRef> { fn mk_type_names() -> type_names { fn hash(&&t: TypeRef) -> uint { ret t as uint; } fn eq(&&a: TypeRef, &&b: TypeRef) -> bool { ret a as uint == b as uint; } - @{type_names: std::map::new_hashmap(hash, eq), - named_types: std::map::new_str_hash()} + @{type_names: std::map::hashmap(hash, eq), + named_types: std::map::str_hash()} } fn type_to_str(names: type_names, ty: TypeRef) -> str { diff --git a/src/rustc/metadata/astencode.rs b/src/rustc/metadata/astencode.rs index aa3fd076627..d095c2271a2 100644 --- a/src/rustc/metadata/astencode.rs +++ b/src/rustc/metadata/astencode.rs @@ -951,7 +951,7 @@ fn roundtrip(in_item: @ast::item) { let mbuf = io::mem_buffer(); let ebml_w = ebml::writer(io::mem_buffer_writer(mbuf)); encode_item_ast(ebml_w, in_item); - let ebml_doc = ebml::new_doc(@io::mem_buffer_buf(mbuf)); + let ebml_doc = ebml::doc(@io::mem_buffer_buf(mbuf)); let out_item = decode_item_ast(ebml_doc); #debug["out_item = %s", pprust::item_to_str(out_item)]; assert in_item == out_item; diff --git a/src/rustc/metadata/creader.rs b/src/rustc/metadata/creader.rs index c5b8e4c45c4..aaceaa9bd07 100644 --- a/src/rustc/metadata/creader.rs +++ b/src/rustc/metadata/creader.rs @@ -9,7 +9,7 @@ import syntax::visit; import syntax::codemap::span; import util::{filesearch}; import io::writer_util; -import std::map::{hashmap, new_int_hash}; +import std::map::{hashmap, int_hash}; import syntax::print::pprust; import common::*; @@ -20,7 +20,7 @@ export list_file_metadata; // libraries necessary for later resolving, typechecking, linking, etc. fn read_crates(sess: session::session, crate: ast::crate) { let e = @{sess: sess, - crate_cache: std::map::new_str_hash::<int>(), + crate_cache: std::map::str_hash::<int>(), mutable next_crate_num: 1}; let v = visit::mk_simple_visitor(@{visit_view_item: @@ -275,7 +275,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 = new_int_hash::<ast::crate_num>(); + let cnum_map = int_hash::<ast::crate_num>(); for dep: decoder::crate_dep in decoder::get_crate_deps(cdata) { let extrn_cnum = dep.cnum; let cname = dep.ident; diff --git a/src/rustc/metadata/cstore.rs b/src/rustc/metadata/cstore.rs index 24670e1394e..f8071538df4 100644 --- a/src/rustc/metadata/cstore.rs +++ b/src/rustc/metadata/cstore.rs @@ -64,8 +64,8 @@ type use_crate_map = map::hashmap<ast::node_id, ast::crate_num>; fn p(cstore: cstore) -> cstore_private { alt cstore { private(p) { p } } } fn mk_cstore() -> cstore { - let meta_cache = map::new_int_hash::<crate_metadata>(); - let crate_map = map::new_int_hash::<ast::crate_num>(); + let meta_cache = map::int_hash::<crate_metadata>(); + let crate_map = map::int_hash::<ast::crate_num>(); let mod_path_map = new_def_hash(); ret private(@{metas: meta_cache, use_crate_map: crate_map, diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index 6b5169a5296..1af4b3f65a2 100644 --- a/src/rustc/metadata/decoder.rs +++ b/src/rustc/metadata/decoder.rs @@ -81,7 +81,7 @@ fn find_item(item_id: int, items: ebml::doc) -> ebml::doc { // Looks up an item in the given metadata and returns an ebml doc pointing // to the item data. fn lookup_item(item_id: int, data: @[u8]) -> ebml::doc { - let items = ebml::get_doc(ebml::new_doc(data), tag_items); + let items = ebml::get_doc(ebml::doc(data), tag_items); ret find_item(item_id, items); } @@ -169,7 +169,7 @@ fn resolve_path(path: [ast::ident], data: @[u8]) -> [ast::def_id] { ret str::eq(str::from_bytes(data), s); } let s = str::connect(path, "::"); - let md = ebml::new_doc(data); + let md = ebml::doc(data); let paths = ebml::get_doc(md, tag_paths); let eqer = bind eq_item(_, s); let result: [ast::def_id] = []; @@ -274,7 +274,7 @@ fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt, maps: maps, fn get_enum_variants(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) -> [ty::variant_info] { let data = cdata.data; - let items = ebml::get_doc(ebml::new_doc(data), tag_items); + let items = ebml::get_doc(ebml::doc(data), tag_items); let item = find_item(id, items); let infos: [ty::variant_info] = []; let variant_ids = enum_variant_ids(item, cdata); @@ -459,14 +459,14 @@ fn list_crate_attributes(md: ebml::doc, hash: str, out: io::writer) { } fn get_crate_attributes(data: @[u8]) -> [ast::attribute] { - ret get_attributes(ebml::new_doc(data)); + ret get_attributes(ebml::doc(data)); } type crate_dep = {cnum: ast::crate_num, ident: str}; fn get_crate_deps(data: @[u8]) -> [crate_dep] { let deps: [crate_dep] = []; - let cratedoc = ebml::new_doc(data); + let cratedoc = ebml::doc(data); let depsdoc = ebml::get_doc(cratedoc, tag_crate_deps); let crate_num = 1; ebml::tagged_docs(depsdoc, tag_crate_dep) {|depdoc| @@ -488,7 +488,7 @@ fn list_crate_deps(data: @[u8], out: io::writer) { } fn get_crate_hash(data: @[u8]) -> str { - let cratedoc = ebml::new_doc(data); + let cratedoc = ebml::doc(data); let hashdoc = ebml::get_doc(cratedoc, tag_crate_hash); ret str::from_bytes(ebml::doc_data(hashdoc)); } @@ -503,7 +503,7 @@ fn list_crate_items(bytes: @[u8], md: ebml::doc, out: io::writer) { } fn iter_crate_items(bytes: @[u8], proc: fn(str, ast::def_id)) { - let md = ebml::new_doc(bytes); + let md = ebml::doc(bytes); let paths = ebml::get_doc(md, tag_paths); let index = ebml::get_doc(paths, tag_index); let bs = ebml::get_doc(index, tag_index_buckets); @@ -527,7 +527,7 @@ fn get_crate_module_paths(bytes: @[u8]) -> [(ast::def_id, str)] { // find all module (path, def_ids), which are not // fowarded path due to renamed import or reexport let res = []; - let mods = map::new_str_hash(); + let mods = map::str_hash(); iter_crate_items(bytes) {|path, did| let m = mod_of_path(path); if str::is_not_empty(m) { @@ -547,7 +547,7 @@ fn get_crate_module_paths(bytes: @[u8]) -> [(ast::def_id, str)] { fn list_crate_metadata(bytes: @[u8], out: io::writer) { let hash = get_crate_hash(bytes); - let md = ebml::new_doc(bytes); + let md = ebml::doc(bytes); list_crate_attributes(md, hash, out); list_crate_deps(bytes, out); list_crate_items(bytes, md, out); diff --git a/src/rustc/metadata/reachable.rs b/src/rustc/metadata/reachable.rs index d0f144171be..9c911807122 100644 --- a/src/rustc/metadata/reachable.rs +++ b/src/rustc/metadata/reachable.rs @@ -21,7 +21,7 @@ type ctx = {ccx: @middle::trans::common::crate_ctxt, fn find_reachable(ccx: @middle::trans::common::crate_ctxt, crate_mod: _mod) -> map { - let rmap = std::map::new_int_hash(); + let rmap = std::map::int_hash(); traverse_public_mod({ccx: ccx, rmap: rmap}, crate_mod); rmap } diff --git a/src/rustc/middle/alias.rs b/src/rustc/middle/alias.rs index 126f24caeff..043eeca5a65 100644 --- a/src/rustc/middle/alias.rs +++ b/src/rustc/middle/alias.rs @@ -62,8 +62,8 @@ fn check_crate(tcx: ty::ctxt, crate: @ast::crate) -> (copy_map, ref_map) { // Stores information about function arguments that's otherwise not easily // available. let cx = @{tcx: tcx, - copy_map: std::map::new_int_hash(), - ref_map: std::map::new_int_hash(), + copy_map: std::map::int_hash(), + ref_map: std::map::int_hash(), mutable silent: false}; let v = @{visit_fn: bind visit_fn(cx, _, _, _, _, _, _, _), visit_expr: bind visit_expr(cx, _, _, _), diff --git a/src/rustc/middle/ast_map.rs b/src/rustc/middle/ast_map.rs index e64ee524b4d..196586fb10f 100644 --- a/src/rustc/middle/ast_map.rs +++ b/src/rustc/middle/ast_map.rs @@ -60,7 +60,7 @@ fn mk_ast_map_visitor() -> vt { } fn map_crate(sess: session, c: crate) -> map { - let cx = {map: std::map::new_int_hash(), + let cx = {map: std::map::int_hash(), mutable path: [], mutable local_id: 0u, sess: sess}; diff --git a/src/rustc/middle/capture.rs b/src/rustc/middle/capture.rs index 7da4edfc956..aee3815abfa 100644 --- a/src/rustc/middle/capture.rs +++ b/src/rustc/middle/capture.rs @@ -34,7 +34,7 @@ fn check_capture_clause(tcx: ty::ctxt, fn_proto: ast::proto, cap_clause: ast::capture_clause) { let freevars = freevars::get_freevars(tcx, fn_expr_id); - let seen_defs = map::new_int_hash(); + let seen_defs = map::int_hash(); let check_capture_item = fn@(&&cap_item: @ast::capture_item) { let cap_def = tcx.def_map.get(cap_item.id); @@ -93,7 +93,7 @@ fn compute_capture_vars(tcx: ty::ctxt, fn_proto: ast::proto, cap_clause: ast::capture_clause) -> [capture_var] { let freevars = freevars::get_freevars(tcx, fn_expr_id); - let cap_map = map::new_int_hash(); + let cap_map = map::int_hash(); vec::iter(cap_clause.copies) { |cap_item| let cap_def = tcx.def_map.get(cap_item.id); diff --git a/src/rustc/middle/freevars.rs b/src/rustc/middle/freevars.rs index 65a4ae627ea..37f32f657f7 100644 --- a/src/rustc/middle/freevars.rs +++ b/src/rustc/middle/freevars.rs @@ -31,7 +31,7 @@ type freevar_map = hashmap<ast::node_id, freevar_info>; // in order to start the search. fn collect_freevars(def_map: resolve::def_map, blk: ast::blk) -> freevar_info { - let seen = new_int_hash(); + let seen = int_hash(); let refs = @mutable []; fn ignore_item(_i: @ast::item, &&_depth: int, _v: visit::vt<int>) { } @@ -86,7 +86,7 @@ fn collect_freevars(def_map: resolve::def_map, blk: ast::blk) // one pass. This could be improved upon if it turns out to matter. fn annotate_freevars(def_map: resolve::def_map, crate: @ast::crate) -> freevar_map { - let freevars = new_int_hash(); + let freevars = int_hash(); let walk_fn = fn@(_fk: visit::fn_kind, _decl: ast::fn_decl, blk: ast::blk, _sp: span, nid: ast::node_id) { diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs index 9672848f4c8..3f385911980 100644 --- a/src/rustc/middle/kind.rs +++ b/src/rustc/middle/kind.rs @@ -39,7 +39,7 @@ fn check_crate(tcx: ty::ctxt, method_map: typeck::method_map, last_uses: last_use::last_uses, crate: @crate) -> rval_map { let ctx = {tcx: tcx, - rval_map: std::map::new_int_hash(), + rval_map: std::map::int_hash(), method_map: method_map, last_uses: last_uses}; let visit = visit::mk_vt(@{ diff --git a/src/rustc/middle/last_use.rs b/src/rustc/middle/last_use.rs index e38d08dce2d..7b6266ecde5 100644 --- a/src/rustc/middle/last_use.rs +++ b/src/rustc/middle/last_use.rs @@ -58,14 +58,14 @@ fn find_last_uses(c: @crate, def_map: resolve::def_map, visit_stmt: visit_stmt, visit_fn: visit_fn with *visit::default_visitor()}); - let cx = {last_uses: std::map::new_hashmap(hash_use_id, {|a, b| a == b}), + let cx = {last_uses: std::map::hashmap(hash_use_id, {|a, b| a == b}), def_map: def_map, ref_map: ref_map, tcx: tcx, mutable current: [], mutable blocks: nil}; visit::visit_crate(*c, cx, v); - let mini_table = std::map::new_int_hash(); + let mini_table = std::map::int_hash(); cx.last_uses.items {|key, val| if !val { ret; } alt key { diff --git a/src/rustc/middle/mutbl.rs b/src/rustc/middle/mutbl.rs index 5e8a6a1aa45..c5105a2d1e6 100644 --- a/src/rustc/middle/mutbl.rs +++ b/src/rustc/middle/mutbl.rs @@ -123,7 +123,7 @@ type mutbl_map = std::map::hashmap<node_id, ()>; type ctx = {tcx: ty::ctxt, mutbl_map: mutbl_map}; fn check_crate(tcx: ty::ctxt, crate: @crate) -> mutbl_map { - let cx = @{tcx: tcx, mutbl_map: std::map::new_int_hash()}; + let cx = @{tcx: tcx, mutbl_map: std::map::int_hash()}; let v = @{visit_expr: bind visit_expr(cx, _, _, _), visit_decl: bind visit_decl(cx, _, _, _) with *visit::default_visitor()}; diff --git a/src/rustc/middle/pat_util.rs b/src/rustc/middle/pat_util.rs index 4327acdb058..4e57556af17 100644 --- a/src/rustc/middle/pat_util.rs +++ b/src/rustc/middle/pat_util.rs @@ -16,7 +16,7 @@ type pat_id_map = std::map::hashmap<str, 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::def_map, pat: @pat) -> pat_id_map { - let map = std::map::new_str_hash(); + let map = std::map::str_hash(); pat_bindings(dm, pat) {|p_id, _s, n| map.insert(path_to_ident(n), p_id); }; diff --git a/src/rustc/middle/region.rs b/src/rustc/middle/region.rs index 745b3a837a8..0b33b6e2631 100644 --- a/src/rustc/middle/region.rs +++ b/src/rustc/middle/region.rs @@ -296,14 +296,14 @@ fn resolve_crate(sess: session, def_map: resolve::def_map, crate: @ast::crate) -> @region_map { let cx: ctxt = {sess: sess, def_map: def_map, - region_map: @{parents: map::new_int_hash(), - ast_type_to_region: map::new_int_hash(), - local_blocks: map::new_int_hash(), + region_map: @{parents: map::int_hash(), + ast_type_to_region: map::int_hash(), + local_blocks: map::int_hash(), region_name_to_fn: new_def_hash(), ast_type_to_inferred_region: - map::new_int_hash(), - call_site_to_block: map::new_int_hash(), - rvalue_to_block: map::new_int_hash()}, + map::int_hash(), + call_site_to_block: map::int_hash(), + rvalue_to_block: map::int_hash()}, mut bindings: @list::nil, mut queued_locals: [], parent: pa_crate, diff --git a/src/rustc/middle/resolve.rs b/src/rustc/middle/resolve.rs index 0fd4993cad4..6b1296e5919 100644 --- a/src/rustc/middle/resolve.rs +++ b/src/rustc/middle/resolve.rs @@ -8,12 +8,11 @@ import front::attr; import metadata::{csearch, cstore}; import driver::session::session; import util::common::*; -import std::map::{new_int_hash, new_str_hash, new_hashmap}; +import std::map::{int_hash, str_hash, hashmap}; import syntax::codemap::span; import syntax::visit; import visit::vt; import std::{list, deque}; -import std::map::hashmap; import std::list::{list, nil, cons}; import option::{is_none, is_some}; import syntax::print::pprust::*; @@ -82,7 +81,7 @@ fn new_ext_hash() -> ext_hash { ret util::common::def_eq(v1.did, v2.did) && str::eq(v1.ident, v2.ident) && v1.ns == v2.ns; } - ret std::map::new_hashmap::<key, def>(hash, eq); + ret std::map::hashmap::<key, def>(hash, eq); } enum mod_index_entry { @@ -187,14 +186,14 @@ fn resolve_crate_reexports(sess: session, amap: ast_map::map, fn create_env(sess: session, amap: ast_map::map) -> @env { @{cstore: sess.cstore, - def_map: new_int_hash(), + def_map: int_hash(), ast_map: amap, - imports: new_int_hash(), - mutable exp_map: new_int_hash(), - mod_map: new_int_hash(), - block_map: new_int_hash(), + imports: int_hash(), + mutable exp_map: int_hash(), + mod_map: int_hash(), + block_map: int_hash(), ext_map: new_def_hash(), - impl_map: new_int_hash(), + impl_map: int_hash(), impl_cache: new_def_hash(), ext_cache: new_ext_hash(), used_imports: {mutable track: false, mutable data: []}, @@ -289,7 +288,7 @@ fn map_crate(e: @env, c: @ast::crate) { index: index_mod(md), mutable glob_imports: [], mutable globbed_exports: [], - glob_imported_names: new_str_hash(), + glob_imported_names: str_hash(), path: path_from_scope(sc, i.ident)}); } ast::item_native_mod(nmd) { @@ -298,7 +297,7 @@ fn map_crate(e: @env, c: @ast::crate) { index: index_nmod(nmd), mutable glob_imports: [], mutable globbed_exports: [], - glob_imported_names: new_str_hash(), + glob_imported_names: str_hash(), path: path_from_scope(sc, i.ident)}); } _ { } @@ -357,7 +356,7 @@ fn map_crate(e: @env, c: @ast::crate) { index: index_mod(c.node.module), mutable glob_imports: [], mutable globbed_exports: [], - glob_imported_names: new_str_hash(), + glob_imported_names: str_hash(), path: ""}); // Next, assemble the links for globbed imports and exports. @@ -1660,7 +1659,7 @@ fn index_view_items(view_items: [@ast::view_item], } fn index_mod(md: ast::_mod) -> mod_index { - let index = new_str_hash::<list<mod_index_entry>>(); + let index = str_hash::<list<mod_index_entry>>(); index_view_items(md.view_items, index); @@ -1705,7 +1704,7 @@ fn index_mod(md: ast::_mod) -> mod_index { fn index_nmod(md: ast::native_mod) -> mod_index { - let index = new_str_hash::<list<mod_index_entry>>(); + let index = str_hash::<list<mod_index_entry>>(); index_view_items(md.view_items, index); @@ -2141,7 +2140,7 @@ fn check_exports(e: @env) { e.mod_map.values {|_mod| alt _mod.m { some(m) { - let glob_is_re_exported = new_int_hash(); + let glob_is_re_exported = int_hash(); for vi in m.view_items { iter_export_paths(*vi) { |vp| diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 33ea22617d5..a4421752965 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -16,7 +16,7 @@ import libc::c_uint; import std::{map, time}; import std::map::hashmap; -import std::map::{new_int_hash, new_str_hash}; +import std::map::{int_hash, str_hash}; import driver::session; import session::session; import front::attr; @@ -3965,9 +3965,9 @@ fn new_fn_ctxt_w_id(ccx: @crate_ctxt, path: path, mutable llobstacktoken: none::<ValueRef>, mutable llself: none, mutable personality: none, - llargs: new_int_hash::<local_val>(), - lllocals: new_int_hash::<local_val>(), - llupvars: new_int_hash::<ValueRef>(), + llargs: int_hash::<local_val>(), + lllocals: int_hash::<local_val>(), + llupvars: int_hash::<ValueRef>(), mutable lltyparams: [], derived_tydescs: ty::new_ty_hash(), id: id, @@ -4842,7 +4842,7 @@ fn declare_intrinsics(llmod: ModuleRef) -> hashmap<str, ValueRef> { decl_cdecl_fn(llmod, "llvm.memset.p0i8.i64", T_fn(T_memset64_args, T_void())); let trap = decl_cdecl_fn(llmod, "llvm.trap", T_fn(T_trap_args, T_void())); - let intrinsics = new_str_hash::<ValueRef>(); + let intrinsics = str_hash::<ValueRef>(); intrinsics.insert("llvm.gcroot", gcroot); intrinsics.insert("llvm.gcread", gcread); intrinsics.insert("llvm.memmove.p0i8.p0i8.i32", memmove32); @@ -5002,7 +5002,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt, lib::llvm::associate_type(tn, "tydesc", tydesc_type); let crate_map = decl_crate_map(sess, link_meta.name, llmod); let dbg_cx = if sess.opts.debuginfo { - option::some(@{llmetadata: map::new_int_hash(), + option::some(@{llmetadata: map::int_hash(), names: new_namegen()}) } else { option::none @@ -5013,21 +5013,21 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt, llmod: llmod, td: td, tn: tn, - externs: new_str_hash::<ValueRef>(), + externs: str_hash::<ValueRef>(), intrinsics: intrinsics, - item_vals: new_int_hash::<ValueRef>(), + item_vals: int_hash::<ValueRef>(), exp_map: emap, - item_symbols: new_int_hash::<str>(), + item_symbols: int_hash::<str>(), mutable main_fn: none::<ValueRef>, link_meta: link_meta, enum_sizes: ty::new_ty_hash(), discrims: ast_util::new_def_id_hash::<ValueRef>(), - discrim_symbols: new_int_hash::<str>(), + discrim_symbols: int_hash::<str>(), tydescs: ty::new_ty_hash(), - dicts: map::new_hashmap(hash_dict_id, {|a, b| a == b}), + dicts: map::hashmap(hash_dict_id, {|a, b| a == b}), external: util::common::new_def_hash(), - monomorphized: map::new_hashmap(hash_mono_id, {|a, b| a == b}), - module_data: new_str_hash::<ValueRef>(), + monomorphized: map::hashmap(hash_mono_id, {|a, b| a == b}), + module_data: str_hash::<ValueRef>(), lltypes: ty::new_ty_hash(), names: new_namegen(), sha: sha, diff --git a/src/rustc/middle/tstate/auxiliary.rs b/src/rustc/middle/tstate/auxiliary.rs index e49748f6b65..38bfb1e4f71 100644 --- a/src/rustc/middle/tstate/auxiliary.rs +++ b/src/rustc/middle/tstate/auxiliary.rs @@ -4,7 +4,7 @@ import syntax::ast::*; import syntax::ast_util::*; import syntax::{visit, codemap}; import codemap::span; -import std::map::{hashmap, new_int_hash}; +import std::map::{hashmap, int_hash}; import syntax::print::pprust::path_to_str; import tstate::ann::{pre_and_post, pre_and_post_state, empty_ann, prestate, poststate, precond, postcond, @@ -484,7 +484,7 @@ fn num_constraints(m: fn_info) -> uint { ret m.num_constraints; } fn new_crate_ctxt(cx: ty::ctxt) -> crate_ctxt { let na: [mutable ts_ann] = [mutable]; - ret {tcx: cx, node_anns: @mutable na, fm: new_int_hash::<fn_info>()}; + ret {tcx: cx, node_anns: @mutable na, fm: int_hash::<fn_info>()}; } /* Use e's type to determine whether it returns. diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index 51abd59b5f6..036b0177747 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -332,18 +332,18 @@ fn mk_rcache() -> creader_cache { fn eq_cache_entries(a: val, b: val) -> bool { ret a.cnum == b.cnum && a.pos == b.pos && a.len == b.len; } - ret map::new_hashmap(hash_cache_entry, eq_cache_entries); + ret map::hashmap(hash_cache_entry, eq_cache_entries); } fn new_ty_hash<V: copy>() -> map::hashmap<t, V> { - map::new_hashmap({|&&t: t| type_id(t)}, + map::hashmap({|&&t: t| type_id(t)}, {|&&a: t, &&b: t| type_id(a) == type_id(b)}) } fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map, freevars: freevars::freevar_map, region_map: @middle::region::region_map) -> ctxt { - let interner = map::new_hashmap({|&&k: intern_key| + let interner = map::hashmap({|&&k: intern_key| hash_type_structure(k.struct) + option::maybe(0u, k.o_def_id, ast_util::hash_def_id) }, {|&&a, &&b| a == b}); @@ -353,7 +353,7 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map, def_map: dm, region_map: region_map, node_types: @smallintmap::mk(), - node_type_substs: map::new_int_hash(), + node_type_substs: map::int_hash(), items: amap, freevars: freevars, tcache: new_def_hash(), @@ -361,12 +361,12 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map, short_names_cache: new_ty_hash(), needs_drop_cache: new_ty_hash(), kind_cache: new_ty_hash(), - ast_ty_to_ty_cache: map::new_hashmap( + ast_ty_to_ty_cache: map::hashmap( ast_util::hash_ty, ast_util::eq_ty), enum_var_cache: new_def_hash(), iface_method_cache: new_def_hash(), - ty_param_bounds: map::new_int_hash(), - inferred_modes: map::new_int_hash()} + ty_param_bounds: map::int_hash(), + inferred_modes: map::int_hash()} } diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs index db6b6acc40c..253b1a7b532 100644 --- a/src/rustc/middle/typeck.rs +++ b/src/rustc/middle/typeck.rs @@ -13,7 +13,7 @@ import middle::ty::{node_id_to_type, arg, block_ty, ty_param_bounds_and_ty, lookup_class_items}; import util::ppaux::ty_to_str; import std::smallintmap; -import std::map::{hashmap, new_int_hash}; +import std::map::{hashmap, int_hash}; import syntax::print::pprust::*; export check_crate; @@ -1354,7 +1354,7 @@ fn gather_locals(ccx: @crate_ctxt, let {vb: vb, locals: locals, nvi: nvi} = alt old_fcx { none { {vb: ty::unify::mk_var_bindings(), - locals: new_int_hash::<int>(), + locals: int_hash::<int>(), nvi: @mutable 0} } some(fcx) { @@ -2956,7 +2956,7 @@ fn check_const(ccx: @crate_ctxt, _sp: span, e: @ast::expr, id: ast::node_id) { purity: ast::pure_fn, proto: ast::proto_box, var_bindings: ty::unify::mk_var_bindings(), - locals: new_int_hash::<int>(), + locals: int_hash::<int>(), next_var_id: @mutable 0, ccx: ccx}; check_expr(fcx, e); @@ -2975,7 +2975,7 @@ fn check_enum_variants(ccx: @crate_ctxt, sp: span, vs: [ast::variant], purity: ast::pure_fn, proto: ast::proto_box, var_bindings: ty::unify::mk_var_bindings(), - locals: new_int_hash::<int>(), + locals: int_hash::<int>(), next_var_id: @mutable 0, ccx: ccx}; let disr_vals: [int] = []; @@ -3192,7 +3192,7 @@ fn check_method(ccx: @crate_ctxt, method: @ast::method) { } fn class_types(ccx: @crate_ctxt, members: [@ast::class_item]) -> class_map { - let rslt = new_int_hash::<ty::t>(); + let rslt = int_hash::<ty::t>(); for m in members { alt m.node.decl { ast::instance_var(_,t,_,id) { @@ -3513,10 +3513,10 @@ fn check_crate(tcx: ty::ctxt, impl_map: resolve::impl_map, let ccx = @{mutable self_infos: [], impl_map: impl_map, - method_map: std::map::new_int_hash(), - dict_map: std::map::new_int_hash(), + method_map: std::map::int_hash(), + dict_map: std::map::int_hash(), enclosing_class_id: none, - enclosing_class: std::map::new_int_hash(), + enclosing_class: std::map::int_hash(), tcx: tcx}; let visit = visit::mk_simple_visitor(@{ visit_item: bind check_item(ccx, _) diff --git a/src/rustc/syntax/ast_util.rs b/src/rustc/syntax/ast_util.rs index e5a15edf1a3..1182a2c40c3 100644 --- a/src/rustc/syntax/ast_util.rs +++ b/src/rustc/syntax/ast_util.rs @@ -227,7 +227,7 @@ fn eq_def_id(&&a: def_id, &&b: def_id) -> bool { } fn new_def_id_hash<T: copy>() -> std::map::hashmap<def_id, T> { - std::map::new_hashmap(hash_def_id, eq_def_id) + std::map::hashmap(hash_def_id, eq_def_id) } fn block_from_expr(e: @expr) -> blk { diff --git a/src/rustc/syntax/ext/auto_serialize.rs b/src/rustc/syntax/ext/auto_serialize.rs index 23a5b18fe7f..9911930184d 100644 --- a/src/rustc/syntax/ext/auto_serialize.rs +++ b/src/rustc/syntax/ext/auto_serialize.rs @@ -506,7 +506,7 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], id: cx.next_id()}] + tp_inputs; - let tps_map = map::new_str_hash(); + let tps_map = map::str_hash(); vec::iter2(tps, tp_inputs) {|tp, arg| let arg_ident = arg.ident; tps_map.insert( @@ -704,7 +704,7 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, name: str, tps: [ast::ty_param], id: cx.next_id()}] + tp_inputs; - let tps_map = map::new_str_hash(); + let tps_map = map::str_hash(); vec::iter2(tps, tp_inputs) {|tp, arg| let arg_ident = arg.ident; tps_map.insert( diff --git a/src/rustc/syntax/ext/base.rs b/src/rustc/syntax/ext/base.rs index 014cc17b5d5..8a1dd70f360 100644 --- a/src/rustc/syntax/ext/base.rs +++ b/src/rustc/syntax/ext/base.rs @@ -1,7 +1,7 @@ import std::map::hashmap; import driver::session::session; import codemap::{span, expn_info, expanded_from}; -import std::map::new_str_hash; +import std::map::str_hash; type syntax_expander_ = fn@(ext_ctxt, span, ast::mac_arg, ast::mac_body) -> @ast::expr; @@ -25,7 +25,7 @@ enum syntax_extension { fn syntax_expander_table() -> hashmap<str, syntax_extension> { fn builtin(f: syntax_expander_) -> syntax_extension {normal({expander: f, span: none})} - let syntax_expanders = new_str_hash::<syntax_extension>(); + let syntax_expanders = str_hash::<syntax_extension>(); syntax_expanders.insert("fmt", builtin(ext::fmt::expand_syntax_ext)); syntax_expanders.insert("auto_serialize", item_decorator(ext::auto_serialize::expand)); diff --git a/src/rustc/syntax/ext/simplext.rs b/src/rustc/syntax/ext/simplext.rs index 1baf5f97d20..ffc1b8248fe 100644 --- a/src/rustc/syntax/ext/simplext.rs +++ b/src/rustc/syntax/ext/simplext.rs @@ -1,7 +1,7 @@ use std; import codemap::span; -import std::map::{hashmap, new_str_hash}; +import std::map::{hashmap, str_hash}; import driver::session::session; import base::*; @@ -148,7 +148,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: new_str_hash::<selector>(), + {real_binders: str_hash::<selector>(), mutable literal_ast_matchers: []}; //this oughta return binders instead, but macro args are a sequence of //expressions, rather than a single expression @@ -164,7 +164,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 = new_str_hash::<arb_depth<matchable>>(); + let res = str_hash::<arb_depth<matchable>>(); //need to do this first, to check vec lengths. for sel: selector in b.literal_ast_matchers { alt sel(match_expr(e)) { none { ret none; } _ { } } @@ -241,7 +241,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, ()> = new_str_hash::<()>(); + let idents: hashmap<ident, ()> = str_hash::<()>(); fn mark_ident(&&i: ident, _fld: ast_fold, b: bindings, idents: hashmap<ident, ()>) -> ident { if b.contains_key(i) { idents.insert(i, ()); } diff --git a/src/rustc/syntax/parse/parser.rs b/src/rustc/syntax/parse/parser.rs index 4beefe21632..8d3087a61a4 100644 --- a/src/rustc/syntax/parse/parser.rs +++ b/src/rustc/syntax/parse/parser.rs @@ -1,5 +1,5 @@ import either::{left, right}; -import std::map::{hashmap, new_str_hash}; +import std::map::{hashmap, str_hash}; import token::can_begin_expr; import codemap::{span,fss_none}; import util::interner; @@ -143,7 +143,7 @@ fn new_parser(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, // because, if used at the start of a line, they will cause the line to be // interpreted as a specific kind of statement, which would be confusing. fn bad_expr_word_table() -> hashmap<str, ()> { - let words = new_str_hash(); + let words = str_hash(); for word in ["alt", "assert", "be", "break", "check", "claim", "class", "const", "cont", "copy", "crust", "do", "else", "enum", "export", "fail", "fn", "for", "if", "iface", diff --git a/src/rustc/syntax/util/interner.rs b/src/rustc/syntax/util/interner.rs index ff08d88971b..65f52b2fc46 100644 --- a/src/rustc/syntax/util/interner.rs +++ b/src/rustc/syntax/util/interner.rs @@ -11,7 +11,7 @@ type interner<T> = eqer: eqfn<T>}; fn mk<T: copy>(hasher: hashfn<T>, eqer: eqfn<T>) -> interner<T> { - let m = map::new_hashmap::<T, uint>(hasher, eqer); + let m = map::hashmap::<T, uint>(hasher, eqer); ret {map: m, mutable vect: [], hasher: hasher, eqer: eqer}; } diff --git a/src/rustc/util/common.rs b/src/rustc/util/common.rs index 85b694fb954..d37347e1594 100644 --- a/src/rustc/util/common.rs +++ b/src/rustc/util/common.rs @@ -21,7 +21,7 @@ fn hash_def(d: ast::def_id) -> uint { fn new_def_hash<V: copy>() -> std::map::hashmap<ast::def_id, V> { let hasher: std::map::hashfn<ast::def_id> = hash_def; let eqer: std::map::eqfn<ast::def_id> = def_eq; - ret std::map::new_hashmap::<ast::def_id, V>(hasher, eqer); + ret std::map::hashmap::<ast::def_id, V>(hasher, eqer); } fn field_expr(f: ast::field) -> @ast::expr { ret f.node.expr; } diff --git a/src/rustdoc/reexport_pass.rs b/src/rustdoc/reexport_pass.rs index 978c6fc9014..05cea2a39d4 100644 --- a/src/rustdoc/reexport_pass.rs +++ b/src/rustdoc/reexport_pass.rs @@ -71,7 +71,7 @@ fn from_def_assoc_list<V:copy>( fn from_str_assoc_list<V:copy>( list: [(str, V)] ) -> map::hashmap<str, V> { - from_assoc_list(list, bind map::new_str_hash()) + from_assoc_list(list, bind map::str_hash()) } fn build_reexport_def_set(srv: astsrv::srv) -> def_set { @@ -155,7 +155,7 @@ fn build_reexport_path_map(srv: astsrv::srv, -def_map: def_map) -> path_map { let assoc_list = astsrv::exec(srv) {|ctxt| let def_map = from_def_assoc_list(def_assoc_list); - let path_map = map::new_str_hash(); + let path_map = map::str_hash(); ctxt.exp_map.items {|exp_id, defs| let path = alt check ctxt.ast_map.get(exp_id) { diff --git a/src/serializer/serializer.rs b/src/serializer/serializer.rs index b49cd97bb41..ca2b5f54150 100644 --- a/src/serializer/serializer.rs +++ b/src/serializer/serializer.rs @@ -7,7 +7,7 @@ import rustc::syntax::codemap::span; import rustc::middle::ty; import rustc::middle::ast_map; import rustc::util::ppaux; -import std::map::{hashmap, map, new_int_hash}; +import std::map::{hashmap, map, int_hash}; import std::getopts; import io::writer_util; import driver::build_session_options; @@ -90,7 +90,7 @@ impl serialize_ctx for serialize_ctx { fn tp_map(ty_params: [ast::ty_param], tps: [ty::t]) -> tp_map { assert vec::len(tps) == vec::len(ty_params); - let tps_map = new_int_hash(); + let tps_map = int_hash(); vec::iter2(ty_params, tps) {|tp_def,tp_val| tps_map.insert(tp_def.id, tp_val); } diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index a34e0d39032..5883b047309 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -106,7 +106,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 = std::map::new_uint_hash(); + let lines = std::map::uint_hash(); let done = 0_u; let i = 0_u; while i < size { diff --git a/src/test/bench/task-perf-word-count.rs b/src/test/bench/task-perf-word-count.rs index 4000b3aec38..e8c889ad7ef 100644 --- a/src/test/bench/task-perf-word-count.rs +++ b/src/test/bench/task-perf-word-count.rs @@ -71,7 +71,7 @@ mod map_reduce { fn map_task(ctrl: chan<ctrl_proto>, input: str) { // log(error, "map_task " + input); - let intermediates = map::new_str_hash(); + let intermediates = map::str_hash(); fn emit(im: map::hashmap<str, chan<reduce_proto>>, ctrl: chan<ctrl_proto>, key: str, val: int) { @@ -136,7 +136,7 @@ mod map_reduce { let reducers: map::hashmap<str, chan<reduce_proto>>; - reducers = map::new_str_hash(); + reducers = map::str_hash(); let num_mappers = vec::len(inputs) as int; let results = start_mappers(chan(ctrl), inputs); diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs index 76c0807e69b..c4005048bf1 100644 --- a/src/test/compile-fail/map-types.rs +++ b/src/test/compile-fail/map-types.rs @@ -6,7 +6,7 @@ import std::map::map; // Test that iface types printed in error msgs include the type arguments. fn main() { - let x: map<str,str> = map::new_str_hash::<str>() as map::<str,str>; + let x: map<str,str> = map::str_hash::<str>() as map::<str,str>; let y: map<uint,str> = x; //!^ ERROR mismatched types: expected `std::map::map<uint,str>` } diff --git a/src/test/run-fail/unwind-misc-1.rs b/src/test/run-fail/unwind-misc-1.rs index 1dfe41e7279..8d79987a4fe 100644 --- a/src/test/run-fail/unwind-misc-1.rs +++ b/src/test/run-fail/unwind-misc-1.rs @@ -15,7 +15,7 @@ fn main() { ret s == t; } - let map = map::new_hashmap(hash, eq); + let map = map::hashmap(hash, eq); let arr = []; uint::range(0u, 10u) {|i| arr += [@"key stuff"]; diff --git a/src/test/run-pass/auto_serialize.rs b/src/test/run-pass/auto_serialize.rs index 59557465932..75d5fc8b357 100644 --- a/src/test/run-pass/auto_serialize.rs +++ b/src/test/run-pass/auto_serialize.rs @@ -26,7 +26,7 @@ fn test_ser_and_deser<A>(a1: A, let buf = io::mem_buffer(); let w = ebml::writer(buf as io::writer); ebml_ser_fn(w, a1); - let d = ebml::new_doc(@io::mem_buffer_buf(buf)); + let d = ebml::doc(@io::mem_buffer_buf(buf)); let a2 = ebml_deser_fn(ebml::ebml_deserializer(d)); io::print("\na1 = "); io_ser_fn(io::stdout(), a1); diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 10f7388f720..c241d3d9eb1 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -40,7 +40,7 @@ mod map_reduce { } fn map_task(ctrl: chan<ctrl_proto>, input: str) { - let intermediates = map::new_str_hash(); + let intermediates = map::str_hash(); fn emit(im: map::hashmap<str, int>, ctrl: chan<ctrl_proto>, key: str, val: str) { @@ -71,7 +71,7 @@ mod map_reduce { let reducers: map::hashmap<str, int>; - reducers = map::new_str_hash(); + reducers = map::str_hash(); start_mappers(chan(ctrl), inputs); diff --git a/src/test/run-pass/issue-1696.rs b/src/test/run-pass/issue-1696.rs index 249f64d445d..ab142a895e5 100644 --- a/src/test/run-pass/issue-1696.rs +++ b/src/test/run-pass/issue-1696.rs @@ -3,7 +3,7 @@ import std::map; import std::map::hashmap; fn main() { - let m = map::new_bytes_hash(); + let m = map::bytes_hash(); m.insert(str::bytes("foo"), str::bytes("bar")); log(error, m); } |
