std: Rename the hashmap constructors to conform to new standards
Instead of using the new_ prefix just name them after their type
This commit is contained in:
parent
383a801993
commit
3864d6d845
43 changed files with 140 additions and 143 deletions
|
@ -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 = {
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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, _, _, _),
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(@{
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()};
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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()}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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, _)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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, ()); }
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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};
|
||||
}
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>`
|
||||
}
|
||||
|
|
|
@ -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"];
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue