1
Fork 0

Merge remote-tracking branch 'thestinger/old_map' into incoming

Conflicts:
	src/test/bench/core-map.rs
This commit is contained in:
Brian Anderson 2013-02-03 17:55:19 -08:00
commit 3b396d17d6
111 changed files with 528 additions and 641 deletions

View file

@ -448,10 +448,10 @@ expression context, the final namespace qualifier is omitted.
Two examples of paths with type arguments: Two examples of paths with type arguments:
~~~~ ~~~~
# use std::map; # use std::oldmap;
# fn f() { # fn f() {
# fn id<T:Copy>(t: T) -> T { t } # fn id<T:Copy>(t: T) -> T { t }
type t = map::HashMap<int,~str>; // Type arguments used in a type expression type t = oldmap::HashMap<int,~str>; // Type arguments used in a type expression
let x = id::<int>(10); // Type arguments used in a call expression let x = id::<int>(10); // Type arguments used in a call expression
# } # }
~~~~ ~~~~

View file

@ -1791,7 +1791,7 @@ illegal to copy and pass by value.
Generic `type`, `struct`, and `enum` declarations follow the same pattern: Generic `type`, `struct`, and `enum` declarations follow the same pattern:
~~~~ ~~~~
# use std::map::HashMap; # use std::oldmap::HashMap;
type Set<T> = HashMap<T, ()>; type Set<T> = HashMap<T, ()>;
struct Stack<T> { struct Stack<T> {

View file

@ -53,8 +53,8 @@ use core::io::WriterUtil;
use core::result::{Ok, Err}; use core::result::{Ok, Err};
use core::hashmap::linear::LinearMap; use core::hashmap::linear::LinearMap;
use std::getopts::{optflag, optopt, opt_present}; use std::getopts::{optflag, optopt, opt_present};
use std::map::HashMap; use std::oldmap::HashMap;
use std::{map, json, tempfile, term, sort, getopts}; use std::{oldmap, json, tempfile, term, sort, getopts};
use syntax::codemap::span; use syntax::codemap::span;
use syntax::diagnostic::span_handler; use syntax::diagnostic::span_handler;
use syntax::diagnostic; use syntax::diagnostic;
@ -110,9 +110,9 @@ pub struct Cargo {
libdir: Path, libdir: Path,
workdir: Path, workdir: Path,
sourcedir: Path, sourcedir: Path,
sources: map::HashMap<~str, @Source>, sources: oldmap::HashMap<~str, @Source>,
mut current_install: ~str, mut current_install: ~str,
dep_cache: map::HashMap<~str, bool>, dep_cache: oldmap::HashMap<~str, bool>,
opts: Options opts: Options
} }
@ -490,7 +490,7 @@ pub fn parse_source(name: ~str, j: &json::Json) -> @Source {
} }
pub fn try_parse_sources(filename: &Path, pub fn try_parse_sources(filename: &Path,
sources: map::HashMap<~str, @Source>) { sources: oldmap::HashMap<~str, @Source>) {
if !os::path_exists(filename) { return; } if !os::path_exists(filename) { return; }
let c = io::read_whole_file_str(filename); let c = io::read_whole_file_str(filename);
match json::from_str(c.get()) { match json::from_str(c.get()) {
@ -730,7 +730,7 @@ pub fn configure(opts: Options) -> Cargo {
need_dir(&c.libdir); need_dir(&c.libdir);
need_dir(&c.bindir); need_dir(&c.bindir);
for sources.each_key |k| { for sources.each_key_ref |&k| {
let mut s = sources.get(k); let mut s = sources.get(k);
load_source_packages(&c, s); load_source_packages(&c, s);
sources.insert(k, s); sources.insert(k, s);
@ -748,7 +748,7 @@ pub fn configure(opts: Options) -> Cargo {
} }
pub fn for_each_package(c: &Cargo, b: fn(s: @Source, p: &Package)) { pub fn for_each_package(c: &Cargo, b: fn(s: @Source, p: &Package)) {
for c.sources.each_value |v| { for c.sources.each_value_ref |&v| {
for v.packages.each |p| { for v.packages.each |p| {
b(v, p); b(v, p);
} }
@ -833,7 +833,7 @@ pub fn rustc_sysroot() -> ~str {
} }
} }
pub fn install_source(c: &Cargo, path: &Path) { pub fn install_source(c: &mut Cargo, path: &Path) {
debug!("source: %s", path.to_str()); debug!("source: %s", path.to_str());
os::change_dir(path); os::change_dir(path);
@ -872,7 +872,8 @@ pub fn install_source(c: &Cargo, path: &Path) {
} }
} }
pub fn install_git(c: &Cargo, wd: &Path, url: ~str, reference: Option<~str>) { pub fn install_git(c: &mut Cargo, wd: &Path, url: ~str,
reference: Option<~str>) {
run::program_output(~"git", ~[~"clone", url, wd.to_str()]); run::program_output(~"git", ~[~"clone", url, wd.to_str()]);
if reference.is_some() { if reference.is_some() {
let r = reference.get(); let r = reference.get();
@ -883,7 +884,7 @@ pub fn install_git(c: &Cargo, wd: &Path, url: ~str, reference: Option<~str>) {
install_source(c, wd); install_source(c, wd);
} }
pub fn install_curl(c: &Cargo, wd: &Path, url: ~str) { pub fn install_curl(c: &mut Cargo, wd: &Path, url: ~str) {
let tarpath = wd.push("pkg.tar"); let tarpath = wd.push("pkg.tar");
let p = run::program_output(~"curl", ~[~"-f", ~"-s", ~"-o", let p = run::program_output(~"curl", ~[~"-f", ~"-s", ~"-o",
tarpath.to_str(), url]); tarpath.to_str(), url]);
@ -896,14 +897,14 @@ pub fn install_curl(c: &Cargo, wd: &Path, url: ~str) {
install_source(c, wd); install_source(c, wd);
} }
pub fn install_file(c: &Cargo, wd: &Path, path: &Path) { pub fn install_file(c: &mut Cargo, wd: &Path, path: &Path) {
run::program_output(~"tar", ~[~"-x", ~"--strip-components=1", run::program_output(~"tar", ~[~"-x", ~"--strip-components=1",
~"-C", wd.to_str(), ~"-C", wd.to_str(),
~"-f", path.to_str()]); ~"-f", path.to_str()]);
install_source(c, wd); install_source(c, wd);
} }
pub fn install_package(c: &Cargo, src: ~str, wd: &Path, pkg: Package) { pub fn install_package(c: &mut Cargo, src: ~str, wd: &Path, pkg: Package) {
let url = copy pkg.url; let url = copy pkg.url;
let method = match pkg.method { let method = match pkg.method {
~"git" => ~"git", ~"git" => ~"git",
@ -922,7 +923,7 @@ pub fn install_package(c: &Cargo, src: ~str, wd: &Path, pkg: Package) {
} }
pub fn cargo_suggestion(c: &Cargo, fallback: fn()) { pub fn cargo_suggestion(c: &Cargo, fallback: fn()) {
if c.sources.size() == 0u { if c.sources.is_empty() {
error(~"no sources defined - you may wish to run " + error(~"no sources defined - you may wish to run " +
~"`cargo init`"); ~"`cargo init`");
return; return;
@ -930,7 +931,7 @@ pub fn cargo_suggestion(c: &Cargo, fallback: fn()) {
fallback(); fallback();
} }
pub fn install_uuid(c: &Cargo, wd: &Path, uuid: ~str) { pub fn install_uuid(c: &mut Cargo, wd: &Path, uuid: ~str) {
let mut ps = ~[]; let mut ps = ~[];
for_each_package(c, |s, p| { for_each_package(c, |s, p| {
if p.uuid == uuid { if p.uuid == uuid {
@ -954,7 +955,7 @@ pub fn install_uuid(c: &Cargo, wd: &Path, uuid: ~str) {
} }
} }
pub fn install_named(c: &Cargo, wd: &Path, name: ~str) { pub fn install_named(c: &mut Cargo, wd: &Path, name: ~str) {
let mut ps = ~[]; let mut ps = ~[];
for_each_package(c, |s, p| { for_each_package(c, |s, p| {
if p.name == name { if p.name == name {
@ -978,7 +979,8 @@ pub fn install_named(c: &Cargo, wd: &Path, name: ~str) {
} }
} }
pub fn install_uuid_specific(c: &Cargo, wd: &Path, src: ~str, uuid: ~str) { pub fn install_uuid_specific(c: &mut Cargo, wd: &Path, src: ~str,
uuid: ~str) {
match c.sources.find(src) { match c.sources.find(src) {
Some(s) => { Some(s) => {
for s.packages.each |p| { for s.packages.each |p| {
@ -993,7 +995,8 @@ pub fn install_uuid_specific(c: &Cargo, wd: &Path, src: ~str, uuid: ~str) {
error(~"can't find package: " + src + ~"/" + uuid); error(~"can't find package: " + src + ~"/" + uuid);
} }
pub fn install_named_specific(c: &Cargo, wd: &Path, src: ~str, name: ~str) { pub fn install_named_specific(c: &mut Cargo, wd: &Path, src: ~str,
name: ~str) {
match c.sources.find(src) { match c.sources.find(src) {
Some(s) => { Some(s) => {
for s.packages.each |p| { for s.packages.each |p| {
@ -1060,7 +1063,7 @@ pub fn cmd_uninstall(c: &Cargo) {
} }
} }
pub fn install_query(c: &Cargo, wd: &Path, target: ~str) { pub fn install_query(c: &mut Cargo, wd: &Path, target: ~str) {
match c.dep_cache.find(target) { match c.dep_cache.find(target) {
Some(inst) => { Some(inst) => {
if inst { if inst {
@ -1112,10 +1115,7 @@ pub fn install_query(c: &Cargo, wd: &Path, target: ~str) {
// a bit of a hack. It should be cleaned up in the future. // a bit of a hack. It should be cleaned up in the future.
if target == c.current_install { if target == c.current_install {
for c.dep_cache.each |k, _v| { c.dep_cache.clear();
c.dep_cache.remove(k);
}
c.current_install = ~""; c.current_install = ~"";
} }
} }
@ -1128,7 +1128,7 @@ pub fn get_temp_workdir(c: &Cargo) -> Path {
} }
} }
pub fn cmd_install(c: &Cargo) { pub fn cmd_install(c: &mut Cargo) {
unsafe { unsafe {
let wd = get_temp_workdir(c); let wd = get_temp_workdir(c);
@ -1155,7 +1155,7 @@ pub fn cmd_install(c: &Cargo) {
} }
pub fn sync(c: &Cargo) { pub fn sync(c: &Cargo) {
for c.sources.each_key |k| { for c.sources.each_key_ref |&k| {
let mut s = c.sources.get(k); let mut s = c.sources.get(k);
sync_one(c, s); sync_one(c, s);
c.sources.insert(k, s); c.sources.insert(k, s);
@ -1569,7 +1569,7 @@ pub fn cmd_list(c: &Cargo) {
} }
} }
} else { } else {
for c.sources.each_value |v| { for c.sources.each_value_ref |&v| {
print_source(v); print_source(v);
} }
} }
@ -1620,7 +1620,7 @@ pub fn dump_cache(c: &Cargo) {
} }
pub fn dump_sources(c: &Cargo) { pub fn dump_sources(c: &Cargo) {
if c.sources.size() < 1u { if c.sources.is_empty() {
return; return;
} }
@ -1636,7 +1636,7 @@ pub fn dump_sources(c: &Cargo) {
result::Ok(writer) => { result::Ok(writer) => {
let mut hash = ~LinearMap::new(); let mut hash = ~LinearMap::new();
for c.sources.each |k, v| { for c.sources.each_ref |&k, &v| {
let mut chash = ~LinearMap::new(); let mut chash = ~LinearMap::new();
chash.insert(~"url", json::String(v.url)); chash.insert(~"url", json::String(v.url));
@ -1675,7 +1675,7 @@ pub fn copy_warn(srcfile: &Path, destfile: &Path) {
pub fn cmd_sources(c: &Cargo) { pub fn cmd_sources(c: &Cargo) {
if vec::len(c.opts.free) < 3u { if vec::len(c.opts.free) < 3u {
for c.sources.each_value |v| { for c.sources.each_value_ref |&v| {
info(fmt!("%s (%s) via %s", info(fmt!("%s (%s) via %s",
v.name, v.url, v.method)); v.name, v.url, v.method));
} }
@ -1686,8 +1686,8 @@ pub fn cmd_sources(c: &Cargo) {
match action { match action {
~"clear" => { ~"clear" => {
for c.sources.each_key |k| { for c.sources.each_key_ref |&k| {
c.sources.remove(k); c.sources.remove(&k);
} }
info(~"cleared sources"); info(~"cleared sources");
@ -1706,7 +1706,7 @@ pub fn cmd_sources(c: &Cargo) {
return; return;
} }
if c.sources.contains_key(name) { if c.sources.contains_key_ref(&name) {
error(fmt!("source already exists: %s", name)); error(fmt!("source already exists: %s", name));
} else { } else {
c.sources.insert(name, @Source { c.sources.insert(name, @Source {
@ -1733,8 +1733,8 @@ pub fn cmd_sources(c: &Cargo) {
return; return;
} }
if c.sources.contains_key(name) { if c.sources.contains_key_ref(&name) {
c.sources.remove(name); c.sources.remove(&name);
info(fmt!("removed source: %s", name)); info(fmt!("removed source: %s", name));
} else { } else {
error(fmt!("no such source: %s", name)); error(fmt!("no such source: %s", name));
@ -1825,7 +1825,7 @@ pub fn cmd_sources(c: &Cargo) {
match c.sources.find(name) { match c.sources.find(name) {
Some(source) => { Some(source) => {
c.sources.remove(name); c.sources.remove(&name);
c.sources.insert(newn, source); c.sources.insert(newn, source);
info(fmt!("renamed source: %s to %s", name, newn)); info(fmt!("renamed source: %s to %s", name, newn));
} }
@ -1967,7 +1967,7 @@ pub fn main() {
match o.free[1] { match o.free[1] {
~"init" => cmd_init(&c), ~"init" => cmd_init(&c),
~"install" => cmd_install(&c), ~"install" => cmd_install(&mut c),
~"uninstall" => cmd_uninstall(&c), ~"uninstall" => cmd_uninstall(&c),
~"list" => cmd_list(&c), ~"list" => cmd_list(&c),
~"search" => cmd_search(&c), ~"search" => cmd_search(&c),

View file

@ -36,7 +36,7 @@ use core::ptr;
use core::run; use core::run;
use core::str; use core::str;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use std::sha1::sha1; use std::sha1::sha1;
use syntax::ast; use syntax::ast;
use syntax::ast_map::{path, path_mod, path_name}; use syntax::ast_map::{path, path_mod, path_name};

View file

@ -18,8 +18,8 @@ use core::os;
use core::uint; use core::uint;
use core::util; use core::util;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use std::map; use std::oldmap;
pure fn not_win32(os: session::os) -> bool { pure fn not_win32(os: session::os) -> bool {
match os { match os {
@ -187,7 +187,7 @@ pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
} }
pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] { pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
let set = map::HashMap(); let set = oldmap::HashMap();
let mut minimized = ~[]; let mut minimized = ~[];
for rpaths.each |rpath| { for rpaths.each |rpath| {
let s = rpath.to_str(); let s = rpath.to_str();

View file

@ -35,7 +35,7 @@ use std::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts};
use std::getopts::groups; use std::getopts::groups;
use std::getopts::{opt_present}; use std::getopts::{opt_present};
use std::getopts; use std::getopts;
use std::map::HashMap; use std::oldmap::HashMap;
use std; use std;
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;

View file

@ -20,7 +20,7 @@ use core::ptr;
use core::str; use core::str;
use core::uint; use core::uint;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
pub type Opcode = u32; pub type Opcode = u32;
pub type Bool = c_uint; pub type Bool = c_uint;

View file

@ -30,7 +30,7 @@ use syntax::parse::token::ident_interner;
use syntax::print::pprust; use syntax::print::pprust;
use syntax::visit; use syntax::visit;
use syntax::{ast, ast_util}; use syntax::{ast, ast_util};
use std::map::HashMap; use std::oldmap::HashMap;
// Traverses an AST, reading all the information about use'd crates and extern // Traverses an AST, reading all the information about use'd crates and extern
// libraries necessary for later resolving, typechecking, linking, etc. // libraries necessary for later resolving, typechecking, linking, etc.

View file

@ -23,7 +23,7 @@ use core::dvec::DVec;
use core::vec; use core::vec;
use reader = std::ebml::reader; use reader = std::ebml::reader;
use std::ebml; use std::ebml;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;
use syntax::codemap::dummy_sp; use syntax::codemap::dummy_sp;

View file

@ -21,8 +21,8 @@ use metadata::decoder;
use core::option; use core::option;
use core::str; use core::str;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use std::map; use std::oldmap;
use std; use std;
use syntax::{ast, attr}; use syntax::{ast, attr};
use syntax::parse::token::ident_interner; use syntax::parse::token::ident_interner;
@ -31,7 +31,7 @@ use syntax::parse::token::ident_interner;
// local crate numbers (as generated during this session). Each external // local crate numbers (as generated during this session). Each external
// crate may refer to types in other external crates, and each has their // crate may refer to types in other external crates, and each has their
// own crate numbers. // own crate numbers.
pub type cnum_map = map::HashMap<ast::crate_num, ast::crate_num>; pub type cnum_map = oldmap::HashMap<ast::crate_num, ast::crate_num>;
pub type crate_metadata = @{name: ~str, pub type crate_metadata = @{name: ~str,
data: @~[u8], data: @~[u8],
@ -46,7 +46,7 @@ pub type crate_metadata = @{name: ~str,
pub enum CStore { private(cstore_private), } pub enum CStore { private(cstore_private), }
type cstore_private = type cstore_private =
@{metas: map::HashMap<ast::crate_num, crate_metadata>, @{metas: oldmap::HashMap<ast::crate_num, crate_metadata>,
use_crate_map: use_crate_map, use_crate_map: use_crate_map,
mut used_crate_files: ~[Path], mut used_crate_files: ~[Path],
mut used_libraries: ~[~str], mut used_libraries: ~[~str],
@ -54,7 +54,7 @@ type cstore_private =
intr: @ident_interner}; intr: @ident_interner};
// Map from node_id's of local use statements to crate numbers // Map from node_id's of local use statements to crate numbers
type use_crate_map = map::HashMap<ast::node_id, ast::crate_num>; type use_crate_map = oldmap::HashMap<ast::node_id, ast::crate_num>;
// Internal method to retrieve the data from the cstore // Internal method to retrieve the data from the cstore
pure fn p(cstore: CStore) -> cstore_private { pure fn p(cstore: CStore) -> cstore_private {
@ -62,8 +62,8 @@ pure fn p(cstore: CStore) -> cstore_private {
} }
pub fn mk_cstore(intr: @ident_interner) -> CStore { pub fn mk_cstore(intr: @ident_interner) -> CStore {
let meta_cache = map::HashMap(); let meta_cache = oldmap::HashMap();
let crate_map = map::HashMap(); let crate_map = oldmap::HashMap();
return private(@{metas: meta_cache, return private(@{metas: meta_cache,
use_crate_map: crate_map, use_crate_map: crate_map,
mut used_crate_files: ~[], mut used_crate_files: ~[],
@ -94,12 +94,12 @@ pub fn set_crate_data(cstore: CStore,
} }
pub fn have_crate_data(cstore: CStore, cnum: ast::crate_num) -> bool { pub fn have_crate_data(cstore: CStore, cnum: ast::crate_num) -> bool {
return p(cstore).metas.contains_key(cnum); return p(cstore).metas.contains_key_ref(&cnum);
} }
pub fn iter_crate_data(cstore: CStore, pub fn iter_crate_data(cstore: CStore,
i: fn(ast::crate_num, crate_metadata)) { i: fn(ast::crate_num, crate_metadata)) {
for p(cstore).metas.each |k,v| { i(k, v);}; for p(cstore).metas.each_ref |&k, &v| { i(k, v);};
} }
pub fn add_used_crate_file(cstore: CStore, lib: &Path) { pub fn add_used_crate_file(cstore: CStore, lib: &Path) {
@ -148,7 +148,7 @@ pub fn get_dep_hashes(cstore: CStore) -> ~[~str] {
type crate_hash = {name: ~str, hash: ~str}; type crate_hash = {name: ~str, hash: ~str};
let mut result = ~[]; let mut result = ~[];
for p(cstore).use_crate_map.each_value |cnum| { for p(cstore).use_crate_map.each_value_ref |&cnum| {
let cdata = cstore::get_crate_data(cstore, cnum); let cdata = cstore::get_crate_data(cstore, cnum);
let hash = decoder::get_crate_hash(cdata.data); let hash = decoder::get_crate_hash(cdata.data);
debug!("Add hash[%s]: %s", cdata.name, hash); debug!("Add hash[%s]: %s", cdata.name, hash);

View file

@ -36,8 +36,8 @@ use core::str;
use core::vec; use core::vec;
use std::ebml::reader; use std::ebml::reader;
use std::ebml; use std::ebml;
use std::map::HashMap; use std::oldmap::HashMap;
use std::map; use std::oldmap;
use std::serialize::Decodable; use std::serialize::Decodable;
use syntax::ast_map; use syntax::ast_map;
use syntax::attr; use syntax::attr;

View file

@ -36,9 +36,9 @@ use core::str;
use core::to_bytes::IterBytes; use core::to_bytes::IterBytes;
use core::uint; use core::uint;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use std::serialize::Encodable; use std::serialize::Encodable;
use std::{ebml, map}; use std::{ebml, oldmap};
use std; use std;
use syntax::ast::*; use syntax::ast::*;
use syntax::ast; use syntax::ast;
@ -52,7 +52,7 @@ use syntax;
use writer = std::ebml::writer; use writer = std::ebml::writer;
// used by astencode: // used by astencode:
type abbrev_map = map::HashMap<ty::t, tyencode::ty_abbrev>; type abbrev_map = oldmap::HashMap<ty::t, tyencode::ty_abbrev>;
pub type encode_inlined_item = fn@(ecx: @encode_ctxt, pub type encode_inlined_item = fn@(ecx: @encode_ctxt,
ebml_w: writer::Encoder, ebml_w: writer::Encoder,
@ -99,7 +99,7 @@ pub enum encode_ctxt = {
}; };
pub fn reachable(ecx: @encode_ctxt, id: node_id) -> bool { pub fn reachable(ecx: @encode_ctxt, id: node_id) -> bool {
ecx.reachable.contains_key(id) ecx.reachable.contains_key_ref(&id)
} }
fn encode_name(ecx: @encode_ctxt, ebml_w: writer::Encoder, name: ident) { fn encode_name(ecx: @encode_ctxt, ebml_w: writer::Encoder, name: ident) {

View file

@ -27,7 +27,7 @@ use core::vec;
use syntax::ast; use syntax::ast;
use syntax::ast::*; use syntax::ast::*;
use syntax::codemap::{respan, dummy_sp}; use syntax::codemap::{respan, dummy_sp};
use std::map::HashMap; use std::oldmap::HashMap;
// Compact string representation for ty::t values. API ty_str & // Compact string representation for ty::t values. API ty_str &
// parse_from_str. Extra parameters are for converting to/from def_ids in the // parse_from_str. Extra parameters are for converting to/from def_ids in the

View file

@ -20,7 +20,7 @@ use core::io::WriterUtil;
use core::io; use core::io;
use core::uint; use core::uint;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::*; use syntax::ast::*;
use syntax::diagnostic::span_handler; use syntax::diagnostic::span_handler;
use syntax::print::pprust::*; use syntax::print::pprust::*;

View file

@ -31,7 +31,7 @@ use std::ebml::reader::get_doc;
use std::ebml::reader; use std::ebml::reader;
use std::ebml::writer::Encoder; use std::ebml::writer::Encoder;
use std::ebml; use std::ebml;
use std::map::HashMap; use std::oldmap::HashMap;
use std::prettyprint; use std::prettyprint;
use std::serialize; use std::serialize;
use std::serialize::{Encodable, EncoderHelpers, DecoderHelpers}; use std::serialize::{Encodable, EncoderHelpers, DecoderHelpers};

View file

@ -35,7 +35,7 @@ use core::cmp;
use core::dvec::DVec; use core::dvec::DVec;
use core::uint; use core::uint;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::{m_const, m_imm, m_mutbl}; use syntax::ast::{m_const, m_imm, m_mutbl};
use syntax::ast; use syntax::ast;
use syntax::ast_util; use syntax::ast_util;
@ -665,7 +665,7 @@ fn check_loans_in_expr(expr: @ast::expr,
self.check_for_conflicting_loans(expr.id); self.check_for_conflicting_loans(expr.id);
if self.bccx.moves_map.contains_key(expr.id) { if self.bccx.moves_map.contains_key_ref(&expr.id) {
self.check_move_out_from_expr(expr); self.check_move_out_from_expr(expr);
} }
@ -686,7 +686,7 @@ fn check_loans_in_expr(expr: @ast::expr,
} }
ast::expr_index(_, rval) | ast::expr_index(_, rval) |
ast::expr_binary(_, _, rval) ast::expr_binary(_, _, rval)
if self.bccx.method_map.contains_key(expr.id) => { if self.bccx.method_map.contains_key_ref(&expr.id) => {
self.check_call(expr, self.check_call(expr,
None, None,
expr.callee_id, expr.callee_id,
@ -694,7 +694,7 @@ fn check_loans_in_expr(expr: @ast::expr,
~[rval]); ~[rval]);
} }
ast::expr_unary(*) | ast::expr_index(*) ast::expr_unary(*) | ast::expr_index(*)
if self.bccx.method_map.contains_key(expr.id) => { if self.bccx.method_map.contains_key_ref(&expr.id) => {
self.check_call(expr, self.check_call(expr,
None, None,
expr.callee_id, expr.callee_id,

View file

@ -33,7 +33,7 @@ use util::ppaux::{expr_repr, region_to_str};
use core::dvec; use core::dvec;
use core::hashmap::linear::LinearSet; use core::hashmap::linear::LinearSet;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::{m_const, m_imm, m_mutbl}; use syntax::ast::{m_const, m_imm, m_mutbl};
use syntax::ast; use syntax::ast;
use syntax::codemap::span; use syntax::codemap::span;
@ -204,7 +204,7 @@ fn req_loans_in_expr(ex: @ast::expr,
ast::expr_binary(_, rcvr, _) | ast::expr_binary(_, rcvr, _) |
ast::expr_unary(_, rcvr) | ast::expr_unary(_, rcvr) |
ast::expr_assign_op(_, rcvr, _) ast::expr_assign_op(_, rcvr, _)
if self.bccx.method_map.contains_key(ex.id) => { if self.bccx.method_map.contains_key_ref(&ex.id) => {
// Receivers in method calls are always passed by ref. // Receivers in method calls are always passed by ref.
// //
// Here, in an overloaded operator, the call is this expression, // Here, in an overloaded operator, the call is this expression,
@ -241,7 +241,7 @@ fn req_loans_in_expr(ex: @ast::expr,
// } // }
ast::expr_field(rcvr, _, _) ast::expr_field(rcvr, _, _)
if self.bccx.method_map.contains_key(ex.id) => { if self.bccx.method_map.contains_key_ref(&ex.id) => {
// Receivers in method calls are always passed by ref. // Receivers in method calls are always passed by ref.
// //
// Here, the field a.b is in fact a closure. Eventually, this // Here, the field a.b is in fact a closure. Eventually, this

View file

@ -241,7 +241,7 @@ use core::io;
use core::result::{Result, Ok, Err}; use core::result::{Result, Ok, Err};
use std::list::{List, Cons, Nil}; use std::list::{List, Cons, Nil};
use std::list; use std::list;
use std::map::{HashMap, Set}; use std::oldmap::{HashMap, Set};
use syntax::ast::{mutability, m_mutbl, m_imm, m_const}; use syntax::ast::{mutability, m_mutbl, m_imm, m_const};
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;

View file

@ -375,7 +375,7 @@ impl PreserveCtxt {
// scope_id;`. Though that would potentially re-introduce // scope_id;`. Though that would potentially re-introduce
// the ICE. See #3511 for more details. // the ICE. See #3511 for more details.
let scope_to_use = if let scope_to_use = if
self.bccx.stmt_map.contains_key(scope_id) { self.bccx.stmt_map.contains_key_ref(&scope_id) {
// Root it in its parent scope, b/c // Root it in its parent scope, b/c
// trans won't introduce a new scope for the // trans won't introduce a new scope for the
// stmt // stmt

View file

@ -18,7 +18,7 @@ use util::ppaux;
use core::dvec::DVec; use core::dvec::DVec;
use core::option; use core::option;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::*; use syntax::ast::*;
use syntax::codemap; use syntax::codemap;
use syntax::{visit, ast_util, ast_map}; use syntax::{visit, ast_util, ast_map};
@ -102,7 +102,7 @@ pub fn check_expr(sess: Session,
} }
expr_lit(@codemap::spanned {node: lit_str(_), _}) => { } expr_lit(@codemap::spanned {node: lit_str(_), _}) => { }
expr_binary(_, _, _) | expr_unary(_, _) => { expr_binary(_, _, _) | expr_unary(_, _) => {
if method_map.contains_key(e.id) { if method_map.contains_key_ref(&e.id) {
sess.span_err(e.span, ~"user-defined operators are not \ sess.span_err(e.span, ~"user-defined operators are not \
allowed in constant expressions"); allowed in constant expressions");
} }

View file

@ -23,7 +23,7 @@ use core::cmp;
use core::option; use core::option;
use core::uint; use core::uint;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use std::sort; use std::sort;
use syntax::ast::*; use syntax::ast::*;
use syntax::ast_util::{variant_def_ids, unguarded_pat, walk_pat}; use syntax::ast_util::{variant_def_ids, unguarded_pat, walk_pat};
@ -59,7 +59,7 @@ pub fn expr_is_non_moving_lvalue(cx: @MatchCheckCtxt, expr: @expr) -> bool {
return false; return false;
} }
!cx.moves_map.contains_key(expr.id) !cx.moves_map.contains_key_ref(&expr.id)
} }
pub fn check_expr(cx: @MatchCheckCtxt, ex: @expr, &&s: (), v: visit::vt<()>) { pub fn check_expr(cx: @MatchCheckCtxt, ex: @expr, &&s: (), v: visit::vt<()>) {
@ -734,7 +734,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
by_ref_span = Some(span); by_ref_span = Some(span);
} }
bind_infer => { bind_infer => {
if cx.moves_map.contains_key(id) { if cx.moves_map.contains_key_ref(&id) {
any_by_move = true; any_by_move = true;
} }
} }
@ -774,7 +774,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
if pat_is_binding(def_map, p) { if pat_is_binding(def_map, p) {
match p.node { match p.node {
pat_ident(_, _, sub) => { pat_ident(_, _, sub) => {
if cx.moves_map.contains_key(p.id) { if cx.moves_map.contains_key_ref(&p.id) {
check_move(p, sub); check_move(p, sub);
} }
} }
@ -800,7 +800,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
behind_bad_pointer); behind_bad_pointer);
if behind_bad_pointer && if behind_bad_pointer &&
cx.moves_map.contains_key(pat.id) cx.moves_map.contains_key_ref(&pat.id)
{ {
cx.tcx.sess.span_err( cx.tcx.sess.span_err(
pat.span, pat.span,

View file

@ -18,7 +18,7 @@ use middle::ty;
use core::int; use core::int;
use core::option::*; use core::option::*;
use core::vec; use core::vec;
use std::map::*; use std::oldmap::*;
use syntax::codemap::span; use syntax::codemap::span;
use syntax::print::pprust::path_to_str; use syntax::print::pprust::path_to_str;
use syntax::{ast, ast_util, visit}; use syntax::{ast, ast_util, visit};
@ -71,7 +71,7 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk)
} }
if i == depth { // Made it to end of loop if i == depth { // Made it to end of loop
let dnum = ast_util::def_id_of_def(def).node; let dnum = ast_util::def_id_of_def(def).node;
if !seen.contains_key(dnum) { if !seen.contains_key_ref(&dnum) {
refs.push(@freevar_entry { refs.push(@freevar_entry {
def: def, def: def,
span: expr.span, span: expr.span,

View file

@ -24,7 +24,7 @@ use util::ppaux::{ty_to_str, tys_to_str};
use core::option; use core::option;
use core::str; use core::str;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::*; use syntax::ast::*;
use syntax::codemap::{span, spanned}; use syntax::codemap::{span, spanned};
use syntax::print::pprust::expr_to_str; use syntax::print::pprust::expr_to_str;

View file

@ -33,7 +33,7 @@ use syntax::visit::{default_simple_visitor, mk_simple_visitor, SimpleVisitor};
use syntax::visit::{visit_crate, visit_item}; use syntax::visit::{visit_crate, visit_item};
use core::ptr; use core::ptr;
use std::map::HashMap; use std::oldmap::HashMap;
use str_eq = str::eq; use str_eq = str::eq;
pub enum LangItem { pub enum LangItem {
@ -391,7 +391,7 @@ impl LanguageItemCollector {
} }
fn check_completeness() { fn check_completeness() {
for self.item_refs.each |key, item_ref| { for self.item_refs.each_ref |&key, &item_ref| {
match self.items.items[item_ref] { match self.items.items[item_ref] {
None => { None => {
self.session.err(fmt!("no item found for `%s`", key)); self.session.err(fmt!("no item found for `%s`", key));

View file

@ -32,8 +32,8 @@ use core::u32;
use core::u64; use core::u64;
use core::uint; use core::uint;
use core::vec; use core::vec;
use std::map::{Map, HashMap}; use std::oldmap::{Map, HashMap};
use std::map; use std::oldmap;
use std::oldsmallintmap::{Map, SmallIntMap}; use std::oldsmallintmap::{Map, SmallIntMap};
use std::oldsmallintmap; use std::oldsmallintmap;
use syntax::ast_util::{path_to_ident}; use syntax::ast_util::{path_to_ident};
@ -233,7 +233,7 @@ pub fn get_lint_dict() -> lint_dict {
default: warn}), default: warn}),
*/ */
]; ];
map::hash_from_vec(v) oldmap::hash_from_vec(v)
} }
// This is a highly not-optimal set of data structure decisions. // This is a highly not-optimal set of data structure decisions.
@ -400,7 +400,9 @@ pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) {
sess: sess}); sess: sess});
// Install defaults. // Install defaults.
for cx.dict.each |_k, spec| { cx.set_level(spec.lint, spec.default); } for cx.dict.each_value_ref |&spec| {
cx.set_level(spec.lint, spec.default);
}
// Install command-line options, overriding defaults. // Install command-line options, overriding defaults.
for sess.opts.lint_opts.each |pair| { for sess.opts.lint_opts.each |pair| {

View file

@ -119,7 +119,7 @@ use core::ptr;
use core::to_str; use core::to_str;
use core::uint; use core::uint;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::*; use syntax::ast::*;
use syntax::codemap::span; use syntax::codemap::span;
use syntax::parse::token::special_idents; use syntax::parse::token::special_idents;

View file

@ -348,7 +348,7 @@ pub impl &mem_categorization_ctxt {
let expr_ty = tcx.ty(expr); let expr_ty = tcx.ty(expr);
match expr.node { match expr.node {
ast::expr_unary(ast::deref, e_base) => { ast::expr_unary(ast::deref, e_base) => {
if self.method_map.contains_key(expr.id) { if self.method_map.contains_key_ref(&expr.id) {
return self.cat_rvalue(expr, expr_ty); return self.cat_rvalue(expr, expr_ty);
} }
@ -357,7 +357,7 @@ pub impl &mem_categorization_ctxt {
} }
ast::expr_field(base, f_name, _) => { ast::expr_field(base, f_name, _) => {
if self.method_map.contains_key(expr.id) { if self.method_map.contains_key_ref(&expr.id) {
return self.cat_method_ref(expr, expr_ty); return self.cat_method_ref(expr, expr_ty);
} }
@ -366,7 +366,7 @@ pub impl &mem_categorization_ctxt {
} }
ast::expr_index(base, _) => { ast::expr_index(base, _) => {
if self.method_map.contains_key(expr.id) { if self.method_map.contains_key_ref(&expr.id) {
return self.cat_rvalue(expr, expr_ty); return self.cat_rvalue(expr, expr_ty);
} }

View file

@ -217,7 +217,7 @@ use util::ppaux;
use util::common::indenter; use util::common::indenter;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::*; use syntax::ast::*;
use syntax::ast_util; use syntax::ast_util;
use syntax::visit; use syntax::visit;
@ -640,7 +640,7 @@ impl VisitContext {
arg_exprs: &[@expr], arg_exprs: &[@expr],
visitor: vt<VisitContext>) -> bool visitor: vt<VisitContext>) -> bool
{ {
if !self.method_map.contains_key(expr.id) { if !self.method_map.contains_key_ref(&expr.id) {
return false; return false;
} }
@ -771,7 +771,7 @@ impl VisitContext {
for arm.pats.each |pat| { for arm.pats.each |pat| {
let mut found = false; let mut found = false;
do pat_bindings(self.tcx.def_map, *pat) |_, node_id, _, _| { do pat_bindings(self.tcx.def_map, *pat) |_, node_id, _, _| {
if moves_map.contains_key(node_id) { if moves_map.contains_key_ref(&node_id) {
found = true; found = true;
} }
} }

View file

@ -18,7 +18,7 @@ use syntax::ast_util::{path_to_ident, walk_pat};
use syntax::fold; use syntax::fold;
use syntax::fold::*; use syntax::fold::*;
use syntax::codemap::{span, respan}; use syntax::codemap::{span, respan};
use std::map::HashMap; use std::oldmap::HashMap;
pub type PatIdMap = HashMap<ident, node_id>; pub type PatIdMap = HashMap<ident, node_id>;

View file

@ -32,7 +32,7 @@ use core::dvec::DVec;
use core::vec; use core::vec;
use std::list; use std::list;
use std::list::list; use std::list::list;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast_map; use syntax::ast_map;
use syntax::codemap::span; use syntax::codemap::span;
use syntax::print::pprust; use syntax::print::pprust;
@ -296,7 +296,7 @@ pub fn resolve_expr(expr: @ast::expr, cx: ctxt, visitor: visit::vt<ctxt>) {
_ => {} _ => {}
}; };
if new_cx.root_exprs.contains_key(expr.id) { if new_cx.root_exprs.contains_key_ref(&expr.id) {
new_cx.parent = Some(expr.id); new_cx.parent = Some(expr.id);
} }
@ -833,7 +833,7 @@ pub fn determine_rp_in_crate(sess: Session,
debug!("%s", { debug!("%s", {
debug!("Region variance results:"); debug!("Region variance results:");
for cx.region_paramd_items.each |key, value| { for cx.region_paramd_items.each_ref |&key, &value| {
debug!("item %? (%s) is parameterized with variance %?", debug!("item %? (%s) is parameterized with variance %?",
key, key,
ast_map::node_id_to_str(ast_map, key, ast_map::node_id_to_str(ast_map, key,

View file

@ -79,7 +79,7 @@ use str::{connect, split_str};
use vec::pop; use vec::pop;
use std::list::{Cons, List, Nil}; use std::list::{Cons, List, Nil};
use std::map::HashMap; use std::oldmap::HashMap;
use str_eq = str::eq; use str_eq = str::eq;
// Definition mapping // Definition mapping
@ -1913,7 +1913,7 @@ pub impl Resolver {
self.module_to_str(module_)); self.module_to_str(module_));
self.resolve_imports_for_module(module_); self.resolve_imports_for_module(module_);
for module_.children.each |_name, child_node| { for module_.children.each_value_ref |&child_node| {
match child_node.get_module_if_available() { match child_node.get_module_if_available() {
None => { None => {
// Nothing to do. // Nothing to do.
@ -1924,7 +1924,7 @@ pub impl Resolver {
} }
} }
for module_.anonymous_children.each |_block_id, child_module| { for module_.anonymous_children.each_value_ref |&child_module| {
self.resolve_imports_for_module_subtree(child_module); self.resolve_imports_for_module_subtree(child_module);
} }
} }
@ -2211,7 +2211,7 @@ pub impl Resolver {
} }
// We've successfully resolved the import. Write the results in. // We've successfully resolved the import. Write the results in.
assert module_.import_resolutions.contains_key(target); assert module_.import_resolutions.contains_key_ref(&target);
let import_resolution = module_.import_resolutions.get(target); let import_resolution = module_.import_resolutions.get(target);
match value_result { match value_result {
@ -2370,7 +2370,7 @@ pub impl Resolver {
} }
// We've successfully resolved the import. Write the results in. // We've successfully resolved the import. Write the results in.
assert module_.import_resolutions.contains_key(target); assert module_.import_resolutions.contains_key_ref(&target);
let import_resolution = module_.import_resolutions.get(target); let import_resolution = module_.import_resolutions.get(target);
match module_result { match module_result {
@ -2430,8 +2430,8 @@ pub impl Resolver {
assert containing_module.glob_count == 0; assert containing_module.glob_count == 0;
// Add all resolved imports from the containing module. // Add all resolved imports from the containing module.
for containing_module.import_resolutions.each for containing_module.import_resolutions.each_ref
|ident, target_import_resolution| { |&ident, &target_import_resolution| {
debug!("(resolving glob import) writing module resolution \ debug!("(resolving glob import) writing module resolution \
%? into `%s`", %? into `%s`",
@ -2480,7 +2480,7 @@ pub impl Resolver {
} }
// Add all children from the containing module. // Add all children from the containing module.
for containing_module.children.each |ident, name_bindings| { for containing_module.children.each_ref |&ident, &name_bindings| {
let mut dest_import_resolution; let mut dest_import_resolution;
match module_.import_resolutions.find(ident) { match module_.import_resolutions.find(ident) {
None => { None => {
@ -3148,7 +3148,7 @@ pub impl Resolver {
} }
// Descend into children and anonymous children. // Descend into children and anonymous children.
for module_.children.each |_name, child_node| { for module_.children.each_value_ref |&child_node| {
match child_node.get_module_if_available() { match child_node.get_module_if_available() {
None => { None => {
// Continue. // Continue.
@ -3159,7 +3159,7 @@ pub impl Resolver {
} }
} }
for module_.anonymous_children.each |_name, module_| { for module_.anonymous_children.each_value_ref |&module_| {
self.report_unresolved_imports(module_); self.report_unresolved_imports(module_);
} }
} }
@ -3204,7 +3204,7 @@ pub impl Resolver {
self.record_exports_for_module(module_); self.record_exports_for_module(module_);
for module_.children.each |_ident, child_name_bindings| { for module_.children.each_value_ref |&child_name_bindings| {
match child_name_bindings.get_module_if_available() { match child_name_bindings.get_module_if_available() {
None => { None => {
// Nothing to do. // Nothing to do.
@ -3215,7 +3215,7 @@ pub impl Resolver {
} }
} }
for module_.anonymous_children.each |_node_id, child_module| { for module_.anonymous_children.each_value_ref |&child_module| {
self.record_exports_for_module_subtree(child_module); self.record_exports_for_module_subtree(child_module);
} }
} }
@ -4068,7 +4068,7 @@ pub impl Resolver {
for arm.pats.eachi() |i, p| { for arm.pats.eachi() |i, p| {
let map_i = self.binding_mode_map(*p); let map_i = self.binding_mode_map(*p);
for map_0.each |key, binding_0| { for map_0.each_ref |&key, &binding_0| {
match map_i.find(key) { match map_i.find(key) {
None => { None => {
self.session.span_err( self.session.span_err(
@ -4089,8 +4089,8 @@ pub impl Resolver {
} }
} }
for map_i.each |key, binding| { for map_i.each_ref |&key, &binding| {
if !map_0.contains_key(key) { if !map_0.contains_key_ref(&key) {
self.session.span_err( self.session.span_err(
binding.span, binding.span,
fmt!("variable `%s` from pattern #%u is \ fmt!("variable `%s` from pattern #%u is \
@ -4319,7 +4319,8 @@ pub impl Resolver {
match bindings_list { match bindings_list {
Some(bindings_list) Some(bindings_list)
if !bindings_list.contains_key(ident) => { if !bindings_list.contains_key_ref(&ident)
=> {
let last_rib = (*self.value_ribs).last(); let last_rib = (*self.value_ribs).last();
last_rib.bindings.insert(ident, last_rib.bindings.insert(ident,
dl_def(def)); dl_def(def));
@ -4391,16 +4392,19 @@ pub impl Resolver {
pat_struct(path, _, _) => { pat_struct(path, _, _) => {
match self.resolve_path(path, TypeNS, false, visitor) { match self.resolve_path(path, TypeNS, false, visitor) {
Some(def_ty(class_id)) Some(def_ty(class_id))
if self.structs.contains_key(class_id) => { if self.structs.contains_key_ref(&class_id)
=> {
let class_def = def_struct(class_id); let class_def = def_struct(class_id);
self.record_def(pattern.id, class_def); self.record_def(pattern.id, class_def);
} }
Some(definition @ def_struct(class_id)) Some(definition @ def_struct(class_id))
if self.structs.contains_key(class_id) => { if self.structs.contains_key_ref(&class_id)
=> {
self.record_def(pattern.id, definition); self.record_def(pattern.id, definition);
} }
Some(definition @ def_variant(_, variant_id)) Some(definition @ def_variant(_, variant_id))
if self.structs.contains_key(variant_id) => { if self.structs.contains_key_ref(&variant_id)
=> {
self.record_def(pattern.id, definition); self.record_def(pattern.id, definition);
} }
result => { result => {
@ -4848,12 +4852,12 @@ pub impl Resolver {
match self.resolve_path(path, TypeNS, false, visitor) { match self.resolve_path(path, TypeNS, false, visitor) {
Some(def_ty(class_id)) | Some(def_struct(class_id)) Some(def_ty(class_id)) | Some(def_struct(class_id))
if self.structs.contains_key(class_id) => { if self.structs.contains_key_ref(&class_id) => {
let class_def = def_struct(class_id); let class_def = def_struct(class_id);
self.record_def(expr.id, class_def); self.record_def(expr.id, class_def);
} }
Some(definition @ def_variant(_, class_id)) Some(definition @ def_variant(_, class_id))
if self.structs.contains_key(class_id) => { if self.structs.contains_key_ref(&class_id) => {
self.record_def(expr.id, definition); self.record_def(expr.id, definition);
} }
_ => { _ => {
@ -4997,7 +5001,7 @@ pub impl Resolver {
} }
// Look for trait children. // Look for trait children.
for search_module.children.each |_name, child_name_bindings| { for search_module.children.each_value_ref |&child_name_bindings| {
match child_name_bindings.def_for_namespace(TypeNS) { match child_name_bindings.def_for_namespace(TypeNS) {
Some(def) => { Some(def) => {
match def { match def {
@ -5017,8 +5021,8 @@ pub impl Resolver {
} }
// Look for imports. // Look for imports.
for search_module.import_resolutions.each for search_module.import_resolutions.each_value_ref
|_ident, import_resolution| { |&import_resolution| {
match import_resolution.target_for_namespace(TypeNS) { match import_resolution.target_for_namespace(TypeNS) {
None => { None => {
@ -5073,7 +5077,7 @@ pub impl Resolver {
self.session.str_of(name)); self.session.str_of(name));
match self.trait_info.find(trait_def_id) { match self.trait_info.find(trait_def_id) {
Some(trait_info) if trait_info.contains_key(name) => { Some(trait_info) if trait_info.contains_key_ref(&name) => {
debug!("(adding trait info if containing method) found trait \ debug!("(adding trait info if containing method) found trait \
%d:%d for method '%s'", %d:%d for method '%s'",
trait_def_id.crate, trait_def_id.crate,
@ -5180,7 +5184,7 @@ pub impl Resolver {
self.check_for_unused_imports_in_module(module_); self.check_for_unused_imports_in_module(module_);
for module_.children.each |_ident, child_name_bindings| { for module_.children.each_value_ref |&child_name_bindings| {
match (*child_name_bindings).get_module_if_available() { match (*child_name_bindings).get_module_if_available() {
None => { None => {
// Nothing to do. // Nothing to do.
@ -5192,13 +5196,13 @@ pub impl Resolver {
} }
} }
for module_.anonymous_children.each |_node_id, child_module| { for module_.anonymous_children.each_value_ref |&child_module| {
self.check_for_unused_imports_in_module_subtree(child_module); self.check_for_unused_imports_in_module_subtree(child_module);
} }
} }
fn check_for_unused_imports_in_module(module_: @Module) { fn check_for_unused_imports_in_module(module_: @Module) {
for module_.import_resolutions.each |_name, import_resolution| { for module_.import_resolutions.each_value_ref |&import_resolution| {
if !import_resolution.used { if !import_resolution.used {
match self.unused_import_lint_level { match self.unused_import_lint_level {
warn => { warn => {
@ -5257,12 +5261,12 @@ pub impl Resolver {
debug!("Dump of module `%s`:", self.module_to_str(module_)); debug!("Dump of module `%s`:", self.module_to_str(module_));
debug!("Children:"); debug!("Children:");
for module_.children.each |name, _child| { for module_.children.each_key_ref |&name| {
debug!("* %s", self.session.str_of(name)); debug!("* %s", self.session.str_of(name));
} }
debug!("Import resolutions:"); debug!("Import resolutions:");
for module_.import_resolutions.each |name, import_resolution| { for module_.import_resolutions.each_ref |&name, &import_resolution| {
let mut value_repr; let mut value_repr;
match (*import_resolution).target_for_namespace(ValueNS) { match (*import_resolution).target_for_namespace(ValueNS) {
None => { value_repr = ~""; } None => { value_repr = ~""; }

View file

@ -164,7 +164,7 @@ use util::common::indenter;
use core::dvec::DVec; use core::dvec::DVec;
use core::dvec; use core::dvec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::def_id; use syntax::ast::def_id;
use syntax::ast; use syntax::ast;
use syntax::ast_util::{dummy_sp, path_to_ident}; use syntax::ast_util::{dummy_sp, path_to_ident};
@ -1085,7 +1085,7 @@ pub fn store_non_ref_bindings(bcx: block,
*/ */
let mut bcx = bcx; let mut bcx = bcx;
for data.bindings_map.each_value |binding_info| { for data.bindings_map.each_value_ref |&binding_info| {
match binding_info.trmode { match binding_info.trmode {
TrByValue(is_move, lldest) => { TrByValue(is_move, lldest) => {
let llval = Load(bcx, binding_info.llmatch); // get a T* let llval = Load(bcx, binding_info.llmatch); // get a T*
@ -1119,7 +1119,7 @@ pub fn insert_lllocals(bcx: block,
* the `fcx.lllocals` map. If add_cleans is true, then adds cleanups for * the `fcx.lllocals` map. If add_cleans is true, then adds cleanups for
* the bindings. */ * the bindings. */
for data.bindings_map.each_value |binding_info| { for data.bindings_map.each_value_ref |&binding_info| {
let llval = match binding_info.trmode { let llval = match binding_info.trmode {
// By value bindings: use the stack slot that we // By value bindings: use the stack slot that we
// copied/moved the value into // copied/moved the value into
@ -1191,14 +1191,14 @@ pub fn compile_guard(bcx: block,
fn drop_bindings(bcx: block, data: &ArmData) -> block { fn drop_bindings(bcx: block, data: &ArmData) -> block {
let mut bcx = bcx; let mut bcx = bcx;
for data.bindings_map.each_value |binding_info| { for data.bindings_map.each_value_ref |&binding_info| {
match binding_info.trmode { match binding_info.trmode {
TrByValue(_, llval) => { TrByValue(_, llval) => {
bcx = glue::drop_ty(bcx, llval, binding_info.ty); bcx = glue::drop_ty(bcx, llval, binding_info.ty);
} }
TrByRef | TrByImplicitRef => {} TrByRef | TrByImplicitRef => {}
} }
bcx.fcx.lllocals.remove(binding_info.id); bcx.fcx.lllocals.remove(&binding_info.id);
} }
return bcx; return bcx;
} }
@ -1586,7 +1586,7 @@ pub fn trans_match_inner(scope_cx: block,
// but during matching we need to store a *T as explained // but during matching we need to store a *T as explained
// above // above
let is_move = let is_move =
scope_cx.ccx().maps.moves_map.contains_key(p_id); scope_cx.ccx().maps.moves_map.contains_key_ref(&p_id);
llmatch = alloca(bcx, T_ptr(llvariable_ty)); llmatch = alloca(bcx, T_ptr(llvariable_ty));
trmode = TrByValue(is_move, alloca(bcx, llvariable_ty)); trmode = TrByValue(is_move, alloca(bcx, llvariable_ty));
} }

View file

@ -75,9 +75,9 @@ use core::libc::{c_uint, c_ulonglong};
use core::option::{is_none, is_some}; use core::option::{is_none, is_some};
use core::option; use core::option;
use core::uint; use core::uint;
use std::map::HashMap; use std::oldmap::HashMap;
use std::oldsmallintmap; use std::oldsmallintmap;
use std::{map, time, list}; use std::{oldmap, time, list};
use syntax::ast_map::{path, path_elt_to_str, path_mod, path_name}; use syntax::ast_map::{path, path_elt_to_str, path_mod, path_name};
use syntax::ast_util::{def_id_of_def, local_def, path_to_ident}; use syntax::ast_util::{def_id_of_def, local_def, path_to_ident};
use syntax::attr; use syntax::attr;
@ -169,8 +169,7 @@ pub fn get_extern_fn(externs: HashMap<~str, ValueRef>,
+name: ~str, +name: ~str,
cc: lib::llvm::CallConv, cc: lib::llvm::CallConv,
ty: TypeRef) -> ValueRef { ty: TypeRef) -> ValueRef {
// XXX: Bad copy. if externs.contains_key_ref(&name) { return externs.get(name); }
if externs.contains_key(copy name) { return externs.get(name); }
// XXX: Bad copy. // XXX: Bad copy.
let f = decl_fn(llmod, copy name, cc, ty); let f = decl_fn(llmod, copy name, cc, ty);
externs.insert(name, f); externs.insert(name, f);
@ -180,8 +179,7 @@ pub fn get_extern_fn(externs: HashMap<~str, ValueRef>,
pub fn get_extern_const(externs: HashMap<~str, ValueRef>, llmod: ModuleRef, pub fn get_extern_const(externs: HashMap<~str, ValueRef>, llmod: ModuleRef,
+name: ~str, ty: TypeRef) -> ValueRef { +name: ~str, ty: TypeRef) -> ValueRef {
unsafe { unsafe {
// XXX: Bad copy. if externs.contains_key_ref(&name) { return externs.get(name); }
if externs.contains_key(copy name) { return externs.get(name); }
let c = str::as_c_str(name, |buf| { let c = str::as_c_str(name, |buf| {
llvm::LLVMAddGlobal(llmod, ty, buf) llvm::LLVMAddGlobal(llmod, ty, buf)
}); });
@ -451,7 +449,7 @@ pub fn set_glue_inlining(f: ValueRef, t: ty::t) {
// silently mangles such symbols, breaking our linkage model. // silently mangles such symbols, breaking our linkage model.
pub fn note_unique_llvm_symbol(ccx: @crate_ctxt, +sym: ~str) { pub fn note_unique_llvm_symbol(ccx: @crate_ctxt, +sym: ~str) {
// XXX: Bad copy. // XXX: Bad copy.
if ccx.all_llvm_symbols.contains_key(copy sym) { if ccx.all_llvm_symbols.contains_key_ref(&sym) {
ccx.sess.bug(~"duplicate LLVM symbol: " + sym); ccx.sess.bug(~"duplicate LLVM symbol: " + sym);
} }
ccx.all_llvm_symbols.insert(sym, ()); ccx.all_llvm_symbols.insert(sym, ());
@ -2485,7 +2483,7 @@ pub fn get_item_val(ccx: @crate_ctxt, id: ast::node_id) -> ValueRef {
ccx.sess.bug(~"get_item_val(): unexpected variant") ccx.sess.bug(~"get_item_val(): unexpected variant")
} }
}; };
if !(exprt || ccx.reachable.contains_key(id)) { if !(exprt || ccx.reachable.contains_key_ref(&id)) {
lib::llvm::SetLinkage(val, lib::llvm::InternalLinkage); lib::llvm::SetLinkage(val, lib::llvm::InternalLinkage);
} }
ccx.item_vals.insert(id, val); ccx.item_vals.insert(id, val);
@ -2798,7 +2796,7 @@ pub fn decl_gc_metadata(ccx: @crate_ctxt, llmod_id: ~str) {
pub fn create_module_map(ccx: @crate_ctxt) -> ValueRef { pub fn create_module_map(ccx: @crate_ctxt) -> ValueRef {
let elttype = T_struct(~[ccx.int_type, ccx.int_type]); let elttype = T_struct(~[ccx.int_type, ccx.int_type]);
let maptype = T_array(elttype, ccx.module_data.size() + 1u); let maptype = T_array(elttype, ccx.module_data.len() + 1);
let map = str::as_c_str(~"_rust_mod_map", |buf| { let map = str::as_c_str(~"_rust_mod_map", |buf| {
unsafe { unsafe {
llvm::LLVMAddGlobal(ccx.llmod, maptype, buf) llvm::LLVMAddGlobal(ccx.llmod, maptype, buf)
@ -2808,7 +2806,7 @@ pub fn create_module_map(ccx: @crate_ctxt) -> ValueRef {
lib::llvm::SetLinkage(map, lib::llvm::InternalLinkage); lib::llvm::SetLinkage(map, lib::llvm::InternalLinkage);
} }
let mut elts: ~[ValueRef] = ~[]; let mut elts: ~[ValueRef] = ~[];
for ccx.module_data.each |key, val| { for ccx.module_data.each_ref |&key, &val| {
let elt = C_struct(~[p2i(ccx, C_cstr(ccx, key)), let elt = C_struct(~[p2i(ccx, C_cstr(ccx, key)),
p2i(ccx, val)]); p2i(ccx, val)]);
elts.push(elt); elts.push(elt);
@ -3016,7 +3014,7 @@ pub fn trans_crate(sess: session::Session,
monomorphized: HashMap(), monomorphized: HashMap(),
monomorphizing: HashMap(), monomorphizing: HashMap(),
type_use_cache: HashMap(), type_use_cache: HashMap(),
vtables: map::HashMap(), vtables: oldmap::HashMap(),
const_cstr_cache: HashMap(), const_cstr_cache: HashMap(),
const_globals: HashMap(), const_globals: HashMap(),
const_values: HashMap(), const_values: HashMap(),
@ -3089,7 +3087,7 @@ pub fn trans_crate(sess: session::Session,
} }
if ccx.sess.count_llvm_insns() { if ccx.sess.count_llvm_insns() {
for ccx.stats.llvm_insns.each |k, v| { for ccx.stats.llvm_insns.each_ref |&k, &v| {
io::println(fmt!("%-7u %s", v, k)); io::println(fmt!("%-7u %s", v, k));
} }
} }

View file

@ -22,7 +22,7 @@ use core::cast;
use core::libc; use core::libc;
use core::str; use core::str;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::codemap; use syntax::codemap;
pub fn terminate(cx: block, _: &str) { pub fn terminate(cx: block, _: &str) {

View file

@ -672,7 +672,8 @@ pub fn trans_arg_expr(bcx: block,
// FIXME(#3548) use the adjustments table // FIXME(#3548) use the adjustments table
match autoref_arg { match autoref_arg {
DoAutorefArg => { DoAutorefArg => {
assert !bcx.ccx().maps.moves_map.contains_key(arg_expr.id); assert !bcx.ccx().maps.moves_map.contains_key_ref(
&arg_expr.id);
val = arg_datum.to_ref_llval(bcx); val = arg_datum.to_ref_llval(bcx);
} }
DontAutorefArg => { DontAutorefArg => {
@ -682,16 +683,16 @@ pub fn trans_arg_expr(bcx: block,
// the explicit self code currently passes by-ref, it // the explicit self code currently passes by-ref, it
// does not hold. // does not hold.
// //
//assert !bcx.ccx().maps.moves_map.contains_key( //assert !bcx.ccx().maps.moves_map.contains_key_ref(
// arg_expr.id); // &arg_expr.id);
val = arg_datum.to_ref_llval(bcx); val = arg_datum.to_ref_llval(bcx);
} }
ast::by_val => { ast::by_val => {
// NB: avoid running the take glue. // NB: avoid running the take glue.
assert !bcx.ccx().maps.moves_map.contains_key( assert !bcx.ccx().maps.moves_map.contains_key_ref(
arg_expr.id); &arg_expr.id);
val = arg_datum.to_value_llval(bcx); val = arg_datum.to_value_llval(bcx);
} }

View file

@ -28,7 +28,7 @@ use middle::trans::type_of::*;
use util::ppaux::ty_to_str; use util::ppaux::ty_to_str;
use core::libc::c_uint; use core::libc::c_uint;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast; use syntax::ast;
use syntax::ast_map::{path, path_mod, path_name}; use syntax::ast_map::{path, path_mod, path_name};
use syntax::ast_util; use syntax::ast_util;

View file

@ -53,7 +53,7 @@ use core::str;
use core::to_bytes; use core::to_bytes;
use core::vec::raw::to_ptr; use core::vec::raw::to_ptr;
use core::vec; use core::vec;
use std::map::{HashMap, Set}; use std::oldmap::{HashMap, Set};
use syntax::ast::ident; use syntax::ast::ident;
use syntax::ast_map::path; use syntax::ast_map::path;
use syntax::codemap::span; use syntax::codemap::span;

View file

@ -126,7 +126,7 @@ pub fn get_const_val(cx: @crate_ctxt, def_id: ast::def_id) -> ValueRef {
if !ast_util::is_local(def_id) { if !ast_util::is_local(def_id) {
cx.tcx.sess.bug(~"cross-crate constants"); cx.tcx.sess.bug(~"cross-crate constants");
} }
if !cx.const_values.contains_key(def_id.node) { if !cx.const_values.contains_key_ref(&def_id.node) {
match cx.tcx.items.get(def_id.node) { match cx.tcx.items.get(def_id.node) {
ast_map::node_item(@ast::item { ast_map::node_item(@ast::item {
node: ast::item_const(_, subexpr), _ node: ast::item_const(_, subexpr), _

View file

@ -183,8 +183,7 @@ pub fn trans_log(log_ex: @ast::expr,
// XXX: Bad copy. // XXX: Bad copy.
let modname = path_str(ccx.sess, copy modpath); let modname = path_str(ccx.sess, copy modpath);
// XXX: Bad copy. let global = if ccx.module_data.contains_key_ref(&modname) {
let global = if ccx.module_data.contains_key(copy modname) {
ccx.module_data.get(modname) ccx.module_data.get(modname)
} else { } else {
let s = link::mangle_internal_name_by_path_and_seq( let s = link::mangle_internal_name_by_path_and_seq(

View file

@ -223,7 +223,7 @@ pub impl Datum {
* `id` is located in the move table, but copies otherwise. * `id` is located in the move table, but copies otherwise.
*/ */
if bcx.ccx().maps.moves_map.contains_key(id) { if bcx.ccx().maps.moves_map.contains_key_ref(&id) {
self.move_to(bcx, action, dst) self.move_to(bcx, action, dst)
} else { } else {
self.copy_to(bcx, action, dst) self.copy_to(bcx, action, dst)

View file

@ -26,8 +26,8 @@ use util::ppaux::ty_to_str;
use core::libc; use core::libc;
use core::option; use core::option;
use core::sys; use core::sys;
use std::map::HashMap; use std::oldmap::HashMap;
use std::map; use std::oldmap;
use syntax::ast::Ty; use syntax::ast::Ty;
use syntax::codemap::{span, CharPos}; use syntax::codemap::{span, CharPos};
use syntax::parse::token::ident_interner; use syntax::parse::token::ident_interner;
@ -111,13 +111,13 @@ pub type debug_ctxt = {
}; };
pub fn mk_ctxt(+crate: ~str, intr: @ident_interner) -> debug_ctxt { pub fn mk_ctxt(+crate: ~str, intr: @ident_interner) -> debug_ctxt {
{llmetadata: map::HashMap(), {llmetadata: oldmap::HashMap(),
names: new_namegen(intr), names: new_namegen(intr),
crate_file: crate} crate_file: crate}
} }
fn update_cache(cache: metadata_cache, mdtag: int, val: debug_metadata) { fn update_cache(cache: metadata_cache, mdtag: int, val: debug_metadata) {
let existing = if cache.contains_key(mdtag) { let existing = if cache.contains_key_ref(&mdtag) {
cache.get(mdtag) cache.get(mdtag)
} else { } else {
~[] ~[]
@ -176,7 +176,7 @@ fn cached_metadata<T: Copy>(cache: metadata_cache,
eq_fn: fn(md: T) -> bool) eq_fn: fn(md: T) -> bool)
-> Option<T> { -> Option<T> {
unsafe { unsafe {
if cache.contains_key(mdtag) { if cache.contains_key_ref(&mdtag) {
let items = cache.get(mdtag); let items = cache.get(mdtag);
for items.each |item| { for items.each |item| {
let md: T = md_from_metadata::<T>(*item); let md: T = md_from_metadata::<T>(*item);

View file

@ -265,7 +265,7 @@ pub fn trans_to_datum(bcx: block, expr: @ast::expr) -> DatumBlock {
} }
pub fn trans_into(bcx: block, expr: @ast::expr, dest: Dest) -> block { pub fn trans_into(bcx: block, expr: @ast::expr, dest: Dest) -> block {
if bcx.tcx().adjustments.contains_key(expr.id) { if bcx.tcx().adjustments.contains_key_ref(&expr.id) {
// use trans_to_datum, which is mildly less efficient but // use trans_to_datum, which is mildly less efficient but
// which will perform the adjustments: // which will perform the adjustments:
let datumblock = trans_to_datum(bcx, expr); let datumblock = trans_to_datum(bcx, expr);
@ -426,7 +426,7 @@ fn trans_rvalue_datum_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
} }
ast::expr_binary(op, lhs, rhs) => { ast::expr_binary(op, lhs, rhs) => {
// if overloaded, would be RvalueDpsExpr // if overloaded, would be RvalueDpsExpr
assert !bcx.ccx().maps.method_map.contains_key(expr.id); assert !bcx.ccx().maps.method_map.contains_key_ref(&expr.id);
return trans_binary(bcx, expr, op, lhs, rhs); return trans_binary(bcx, expr, op, lhs, rhs);
} }
@ -1243,7 +1243,7 @@ fn trans_unary_datum(bcx: block,
assert op != ast::deref; assert op != ast::deref;
// if overloaded, would be RvalueDpsExpr // if overloaded, would be RvalueDpsExpr
assert !bcx.ccx().maps.method_map.contains_key(un_expr.id); assert !bcx.ccx().maps.method_map.contains_key_ref(&un_expr.id);
let un_ty = expr_ty(bcx, un_expr); let un_ty = expr_ty(bcx, un_expr);
let sub_ty = expr_ty(bcx, sub_expr); let sub_ty = expr_ty(bcx, sub_expr);

View file

@ -380,7 +380,7 @@ pub fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) {
let _icx = bcx.insn_ctxt("make_visit_glue"); let _icx = bcx.insn_ctxt("make_visit_glue");
let mut bcx = bcx; let mut bcx = bcx;
let ty_visitor_name = special_idents::ty_visitor; let ty_visitor_name = special_idents::ty_visitor;
assert bcx.ccx().tcx.intrinsic_defs.contains_key(ty_visitor_name); assert bcx.ccx().tcx.intrinsic_defs.contains_key_ref(&ty_visitor_name);
let (trait_id, ty) = bcx.ccx().tcx.intrinsic_defs.get(ty_visitor_name); let (trait_id, ty) = bcx.ccx().tcx.intrinsic_defs.get(ty_visitor_name);
let v = PointerCast(bcx, v, T_ptr(type_of::type_of(bcx.ccx(), ty))); let v = PointerCast(bcx, v, T_ptr(type_of::type_of(bcx.ccx(), ty)));
bcx = reflect::emit_calls_to_trait_visit_ty(bcx, t, v, trait_id); bcx = reflect::emit_calls_to_trait_visit_ty(bcx, t, v, trait_id);
@ -757,7 +757,7 @@ pub fn emit_tydescs(ccx: @crate_ctxt) {
let _icx = ccx.insn_ctxt("emit_tydescs"); let _icx = ccx.insn_ctxt("emit_tydescs");
// As of this point, allow no more tydescs to be created. // As of this point, allow no more tydescs to be created.
ccx.finished_tydescs = true; ccx.finished_tydescs = true;
for ccx.tydescs.each |_key, val| { for ccx.tydescs.each_value_ref |&val| {
let glue_fn_ty = T_ptr(T_generic_glue_fn(ccx)); let glue_fn_ty = T_ptr(T_generic_glue_fn(ccx));
let ti = val; let ti = val;

View file

@ -178,7 +178,7 @@ pub fn llalign_of(cx: @crate_ctxt, t: TypeRef) -> ValueRef {
// Computes the size of the data part of an enum. // Computes the size of the data part of an enum.
pub fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint { pub fn static_size_of_enum(cx: @crate_ctxt, t: ty::t) -> uint {
if cx.enum_sizes.contains_key(t) { return cx.enum_sizes.get(t); } if cx.enum_sizes.contains_key_ref(&t) { return cx.enum_sizes.get(t); }
match ty::get(t).sty { match ty::get(t).sty {
ty::ty_enum(tid, ref substs) => { ty::ty_enum(tid, ref substs) => {
// Compute max(variant sizes). // Compute max(variant sizes).

View file

@ -33,7 +33,7 @@ use middle::typeck;
use util::ppaux::{ty_to_str, tys_to_str}; use util::ppaux::{ty_to_str, tys_to_str};
use core::libc::c_uint; use core::libc::c_uint;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast_map::{path, path_mod, path_name, node_id_to_str}; use syntax::ast_map::{path, path_mod, path_name, node_id_to_str};
use syntax::ast_util::local_def; use syntax::ast_util::local_def;
use syntax::print::pprust::expr_to_str; use syntax::print::pprust::expr_to_str;
@ -871,7 +871,7 @@ pub fn trans_trait_cast(bcx: block,
match vstore { match vstore {
ty::vstore_slice(*) | ty::vstore_box => { ty::vstore_slice(*) | ty::vstore_box => {
let mut llboxdest = GEPi(bcx, lldest, [0u, 1u]); let mut llboxdest = GEPi(bcx, lldest, [0u, 1u]);
if bcx.tcx().legacy_boxed_traits.contains_key(id) { if bcx.tcx().legacy_boxed_traits.contains_key_ref(&id) {
// Allocate an @ box and store the value into it // Allocate an @ box and store the value into it
let {bcx: new_bcx, box: llbox, body: body} = let {bcx: new_bcx, box: llbox, body: body} =
malloc_boxed(bcx, v_ty); malloc_boxed(bcx, v_ty);

View file

@ -22,7 +22,7 @@ use middle::ty;
use middle::typeck; use middle::typeck;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::*; use syntax::ast::*;
use syntax::ast_util::def_id_of_def; use syntax::ast_util::def_id_of_def;
use syntax::attr; use syntax::attr;
@ -95,7 +95,7 @@ fn traverse_public_mod(cx: ctx, mod_id: node_id, m: _mod) {
} }
fn traverse_public_item(cx: ctx, item: @item) { fn traverse_public_item(cx: ctx, item: @item) {
if cx.rmap.contains_key(item.id) { return; } if cx.rmap.contains_key_ref(&item.id) { return; }
cx.rmap.insert(item.id, ()); cx.rmap.insert(item.id, ());
match /*bad*/copy item.node { match /*bad*/copy item.node {
item_mod(m) => traverse_public_mod(cx, item.id, m), item_mod(m) => traverse_public_mod(cx, item.id, m),
@ -145,7 +145,7 @@ fn mk_ty_visitor() -> visit::vt<ctx> {
} }
fn traverse_ty(ty: @Ty, cx: ctx, v: visit::vt<ctx>) { fn traverse_ty(ty: @Ty, cx: ctx, v: visit::vt<ctx>) {
if cx.rmap.contains_key(ty.id) { return; } if cx.rmap.contains_key_ref(&ty.id) { return; }
cx.rmap.insert(ty.id, ()); cx.rmap.insert(ty.id, ());
match ty.node { match ty.node {

View file

@ -24,7 +24,7 @@ use middle::trans::meth;
use middle::trans::type_of::*; use middle::trans::type_of::*;
use util::ppaux::ty_to_str; use util::ppaux::ty_to_str;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::def_id; use syntax::ast::def_id;
use syntax::ast; use syntax::ast;
@ -316,7 +316,7 @@ pub fn emit_calls_to_trait_visit_ty(bcx: block,
-> block { -> block {
use syntax::parse::token::special_idents::tydesc; use syntax::parse::token::special_idents::tydesc;
let final = sub_block(bcx, ~"final"); let final = sub_block(bcx, ~"final");
assert bcx.ccx().tcx.intrinsic_defs.contains_key(tydesc); assert bcx.ccx().tcx.intrinsic_defs.contains_key_ref(&tydesc);
let (_, tydesc_ty) = bcx.ccx().tcx.intrinsic_defs.get(tydesc); let (_, tydesc_ty) = bcx.ccx().tcx.intrinsic_defs.get(tydesc);
let tydesc_ty = type_of::type_of(bcx.ccx(), tydesc_ty); let tydesc_ty = type_of::type_of(bcx.ccx(), tydesc_ty);
let r = reflector({ let r = reflector({

View file

@ -26,7 +26,7 @@ use util::ppaux::ty_to_str;
use core::dvec::DVec; use core::dvec::DVec;
use core::option::is_some; use core::option::is_some;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast; use syntax::ast;
use syntax::codemap::dummy_sp; use syntax::codemap::dummy_sp;
use syntax::codemap::span; use syntax::codemap::span;

View file

@ -17,7 +17,7 @@ use middle::trans::expr;
use middle::trans::machine; use middle::trans::machine;
use util::ppaux; use util::ppaux;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast; use syntax::ast;
pub fn type_of_explicit_arg(ccx: @crate_ctxt, arg: ty::arg) -> TypeRef { pub fn type_of_explicit_arg(ccx: @crate_ctxt, arg: ty::arg) -> TypeRef {
@ -87,7 +87,7 @@ pub fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
debug!("type_of %?: %?", t, ty::get(t)); debug!("type_of %?: %?", t, ty::get(t));
// Check the cache. // Check the cache.
if cx.lltypes.contains_key(t) { return cx.lltypes.get(t); } if cx.lltypes.contains_key_ref(&t) { return cx.lltypes.get(t); }
// Replace any typedef'd types with their equivalent non-typedef // Replace any typedef'd types with their equivalent non-typedef
// type. This ensures that all LLVM nominal types that contain // type. This ensures that all LLVM nominal types that contain

View file

@ -38,7 +38,7 @@ use core::uint;
use core::vec; use core::vec;
use std::list::{List, Cons, Nil}; use std::list::{List, Cons, Nil};
use std::list; use std::list;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::*; use syntax::ast::*;
use syntax::ast_map; use syntax::ast_map;
use syntax::ast_util; use syntax::ast_util;

View file

@ -41,8 +41,8 @@ use core::result;
use core::to_bytes; use core::to_bytes;
use core::uint; use core::uint;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use std::{map, oldsmallintmap}; use std::{oldmap, oldsmallintmap};
use syntax::ast::*; use syntax::ast::*;
use syntax::ast_util::{is_local, local_def}; use syntax::ast_util::{is_local, local_def};
use syntax::ast_util; use syntax::ast_util;
@ -790,11 +790,11 @@ pub type node_type_table = @oldsmallintmap::SmallIntMap<t>;
fn mk_rcache() -> creader_cache { fn mk_rcache() -> creader_cache {
type val = {cnum: int, pos: uint, len: uint}; type val = {cnum: int, pos: uint, len: uint};
return map::HashMap(); return oldmap::HashMap();
} }
pub fn new_ty_hash<V: Copy>() -> map::HashMap<t, V> { pub fn new_ty_hash<V: Copy>() -> oldmap::HashMap<t, V> {
map::HashMap() oldmap::HashMap()
} }
pub fn mk_ctxt(s: session::Session, pub fn mk_ctxt(s: session::Session,
@ -822,7 +822,7 @@ pub fn mk_ctxt(s: session::Session,
} }
} }
let interner = map::HashMap(); let interner = oldmap::HashMap();
let vecs_implicitly_copyable = let vecs_implicitly_copyable =
get_lint_level(s.lint_settings.default_settings, get_lint_level(s.lint_settings.default_settings,
lint::vecs_implicitly_copyable) == allow; lint::vecs_implicitly_copyable) == allow;
@ -839,9 +839,9 @@ pub fn mk_ctxt(s: session::Session,
region_map: region_map, region_map: region_map,
region_paramd_items: region_paramd_items, region_paramd_items: region_paramd_items,
node_types: @oldsmallintmap::mk(), node_types: @oldsmallintmap::mk(),
node_type_substs: map::HashMap(), node_type_substs: oldmap::HashMap(),
items: amap, items: amap,
intrinsic_defs: map::HashMap(), intrinsic_defs: oldmap::HashMap(),
freevars: freevars, freevars: freevars,
tcache: HashMap(), tcache: HashMap(),
rcache: mk_rcache(), rcache: mk_rcache(),
@ -1745,7 +1745,7 @@ pub fn type_needs_unwind_cleanup(cx: ctxt, ty: t) -> bool {
} }
fn type_needs_unwind_cleanup_(cx: ctxt, ty: t, fn type_needs_unwind_cleanup_(cx: ctxt, ty: t,
tycache: map::HashMap<t, ()>, tycache: oldmap::HashMap<t, ()>,
encountered_box: bool) -> bool { encountered_box: bool) -> bool {
// Prevent infinite recursion // Prevent infinite recursion
@ -2795,11 +2795,11 @@ impl sty : to_bytes::IterBytes {
} }
pub fn br_hashmap<V:Copy>() -> HashMap<bound_region, V> { pub fn br_hashmap<V:Copy>() -> HashMap<bound_region, V> {
map::HashMap() oldmap::HashMap()
} }
pub fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t { pub fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t {
//io::println(fmt!("%?/%?", id, cx.node_types.size())); //io::println(fmt!("%?/%?", id, cx.node_types.len()));
match oldsmallintmap::find(*cx.node_types, id as uint) { match oldsmallintmap::find(*cx.node_types, id as uint) {
Some(t) => t, Some(t) => t,
None => cx.sess.bug( None => cx.sess.bug(
@ -2817,7 +2817,7 @@ pub fn node_id_to_type_params(cx: ctxt, id: ast::node_id) -> ~[t] {
} }
fn node_id_has_type_params(cx: ctxt, id: ast::node_id) -> bool { fn node_id_has_type_params(cx: ctxt, id: ast::node_id) -> bool {
return cx.node_type_substs.contains_key(id); return cx.node_type_substs.contains_key_ref(&id);
} }
// Type accessors for substructures of types // Type accessors for substructures of types
@ -3114,7 +3114,7 @@ pub enum ExprKind {
pub fn expr_kind(tcx: ctxt, pub fn expr_kind(tcx: ctxt,
method_map: typeck::method_map, method_map: typeck::method_map,
expr: @ast::expr) -> ExprKind { expr: @ast::expr) -> ExprKind {
if method_map.contains_key(expr.id) { if method_map.contains_key_ref(&expr.id) {
// Overloaded operations are generally calls, and hence they are // Overloaded operations are generally calls, and hence they are
// generated via DPS. However, assign_op (e.g., `x += y`) is an // generated via DPS. However, assign_op (e.g., `x += y`) is an
// exception, as its result is always unit. // exception, as its result is always unit.
@ -4359,7 +4359,7 @@ pub fn iter_bound_traits_and_supertraits(tcx: ctxt,
if f(trait_ty) { if f(trait_ty) {
// Add all the supertraits to the hash map, // Add all the supertraits to the hash map,
// executing <f> on each of them // executing <f> on each of them
while i < supertrait_map.size() && !fin { while i < supertrait_map.len() && !fin {
let init_trait_id = seen_def_ids[i]; let init_trait_id = seen_def_ids[i];
i += 1; i += 1;
// Add supertraits to supertrait_map // Add supertraits to supertrait_map
@ -4368,7 +4368,7 @@ pub fn iter_bound_traits_and_supertraits(tcx: ctxt,
let super_t = supertrait.tpt.ty; let super_t = supertrait.tpt.ty;
let d_id = ty_to_def_id(super_t).expect("supertrait \ let d_id = ty_to_def_id(super_t).expect("supertrait \
should be a trait ty"); should be a trait ty");
if !supertrait_map.contains_key(d_id) { if !supertrait_map.contains_key_ref(&d_id) {
supertrait_map.insert(d_id, super_t); supertrait_map.insert(d_id, super_t);
trait_ty = super_t; trait_ty = super_t;
seen_def_ids.push(d_id); seen_def_ids.push(d_id);

View file

@ -20,7 +20,7 @@ use middle::typeck::check::{structure_of, valid_range_bounds};
use middle::typeck::require_same_types; use middle::typeck::require_same_types;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast; use syntax::ast;
use syntax::ast_util::walk_pat; use syntax::ast_util::walk_pat;
use syntax::ast_util; use syntax::ast_util;
@ -239,7 +239,7 @@ pub fn check_struct_pat_fields(pcx: pat_ctxt,
// Report an error if not all the fields were specified. // Report an error if not all the fields were specified.
if !etc { if !etc {
for class_fields.eachi |i, field| { for class_fields.eachi |i, field| {
if found_fields.contains_key(i) { if found_fields.contains_key_ref(&i) {
loop; loop;
} }
tcx.sess.span_err(span, tcx.sess.span_err(span,

View file

@ -101,7 +101,7 @@ use core::dvec::DVec;
use core::result; use core::result;
use core::uint; use core::uint;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast::{def_id, sty_by_ref, sty_value, sty_region, sty_box}; use syntax::ast::{def_id, sty_by_ref, sty_value, sty_region, sty_box};
use syntax::ast::{sty_uniq, sty_static, node_id, by_copy, by_ref}; use syntax::ast::{sty_uniq, sty_static, node_id, by_copy, by_ref};
use syntax::ast::{m_const, m_mutbl, m_imm}; use syntax::ast::{m_const, m_mutbl, m_imm};
@ -1171,11 +1171,12 @@ pub impl LookupContext {
match candidate.origin { match candidate.origin {
method_static(method_id) | method_self(method_id, _) method_static(method_id) | method_self(method_id, _)
| method_super(method_id, _) => { | method_super(method_id, _) => {
bad = self.tcx().destructors.contains_key(method_id); bad = self.tcx().destructors.contains_key_ref(&method_id);
} }
method_param(method_param { trait_id: trait_id, _ }) | method_param(method_param { trait_id: trait_id, _ }) |
method_trait(trait_id, _, _) => { method_trait(trait_id, _, _) => {
bad = self.tcx().destructor_for_type.contains_key(trait_id); bad = self.tcx().destructor_for_type.contains_key_ref(
&trait_id);
} }
} }

View file

@ -115,8 +115,8 @@ use core::result;
use core::str; use core::str;
use core::vec; use core::vec;
use std::list::Nil; use std::list::Nil;
use std::map::HashMap; use std::oldmap::HashMap;
use std::map; use std::oldmap;
use syntax::ast::{provided, required, ty_i}; use syntax::ast::{provided, required, ty_i};
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;
@ -209,9 +209,9 @@ pub fn blank_inherited(ccx: @crate_ctxt) -> @inherited {
@inherited { @inherited {
infcx: infer::new_infer_ctxt(ccx.tcx), infcx: infer::new_infer_ctxt(ccx.tcx),
locals: HashMap(), locals: HashMap(),
node_types: map::HashMap(), node_types: oldmap::HashMap(),
node_type_substs: map::HashMap(), node_type_substs: oldmap::HashMap(),
adjustments: map::HashMap() adjustments: oldmap::HashMap()
} }
} }
@ -3078,8 +3078,8 @@ pub fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::foreign_item) {
~"visit_tydesc" => { ~"visit_tydesc" => {
let tydesc_name = special_idents::tydesc; let tydesc_name = special_idents::tydesc;
let ty_visitor_name = tcx.sess.ident_of(~"TyVisitor"); let ty_visitor_name = tcx.sess.ident_of(~"TyVisitor");
assert tcx.intrinsic_defs.contains_key(tydesc_name); assert tcx.intrinsic_defs.contains_key_ref(&tydesc_name);
assert ccx.tcx.intrinsic_defs.contains_key(ty_visitor_name); assert ccx.tcx.intrinsic_defs.contains_key_ref(&ty_visitor_name);
let (_, tydesc_ty) = tcx.intrinsic_defs.get(tydesc_name); let (_, tydesc_ty) = tcx.intrinsic_defs.get(tydesc_name);
let (_, visitor_trait) = tcx.intrinsic_defs.get(ty_visitor_name); let (_, visitor_trait) = tcx.intrinsic_defs.get(ty_visitor_name);
let td_ptr = ty::mk_ptr(ccx.tcx, ty::mt {ty: tydesc_ty, let td_ptr = ty::mk_ptr(ccx.tcx, ty::mt {ty: tydesc_ty,

View file

@ -211,7 +211,7 @@ pub fn visit_expr(expr: @ast::expr, &&rcx: @rcx, v: rvt) {
// `constrain_auto_ref()` on all exprs. But that causes a // `constrain_auto_ref()` on all exprs. But that causes a
// lot of spurious errors because of how the region // lot of spurious errors because of how the region
// hierarchy is setup. // hierarchy is setup.
if rcx.fcx.ccx.method_map.contains_key(callee.id) { if rcx.fcx.ccx.method_map.contains_key_ref(&callee.id) {
match callee.node { match callee.node {
ast::expr_field(base, _, _) => { ast::expr_field(base, _, _) => {
constrain_auto_ref(rcx, base); constrain_auto_ref(rcx, base);
@ -750,7 +750,7 @@ pub mod guarantor {
let _i = ::util::common::indenter(); let _i = ::util::common::indenter();
let guarantor = { let guarantor = {
if rcx.fcx.ccx.method_map.contains_key(expr.id) { if rcx.fcx.ccx.method_map.contains_key_ref(&expr.id) {
None None
} else { } else {
guarantor(rcx, expr) guarantor(rcx, expr)

View file

@ -28,7 +28,7 @@ use core::result;
use core::uint; use core::uint;
use core::vec; use core::vec;
use result::{Result, Ok, Err}; use result::{Result, Ok, Err};
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast; use syntax::ast;
use syntax::ast_util; use syntax::ast_util;
use syntax::codemap::span; use syntax::codemap::span;
@ -268,7 +268,7 @@ pub fn lookup_vtable(vcx: &VtableContext,
// im is one specific impl of trait_ty. // im is one specific impl of trait_ty.
// First, ensure we haven't processed this impl yet. // First, ensure we haven't processed this impl yet.
if impls_seen.contains_key(im.did) { if impls_seen.contains_key_ref(&im.did) {
loop; loop;
} }
impls_seen.insert(im.did, ()); impls_seen.insert(im.did, ());

View file

@ -28,7 +28,7 @@ use util::ppaux;
use core::result::{Result, Ok, Err}; use core::result::{Result, Ok, Err};
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast; use syntax::ast;
use syntax::codemap::span; use syntax::codemap::span;
use syntax::print::pprust::pat_to_str; use syntax::print::pprust::pat_to_str;
@ -141,7 +141,7 @@ fn maybe_resolve_type_vars_for_node(wbcx: wb_ctxt, sp: span,
id: ast::node_id) id: ast::node_id)
-> Option<ty::t> -> Option<ty::t>
{ {
if wbcx.fcx.inh.node_types.contains_key(id) { if wbcx.fcx.inh.node_types.contains_key_ref(&id) {
resolve_type_vars_for_node(wbcx, sp, id) resolve_type_vars_for_node(wbcx, sp, id)
} else { } else {
None None

View file

@ -63,7 +63,7 @@ use core::uint::range;
use core::uint; use core::uint;
use core::vec::{len, push}; use core::vec::{len, push};
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
pub struct UniversalQuantificationResult { pub struct UniversalQuantificationResult {
monotype: t, monotype: t,
@ -417,7 +417,7 @@ pub impl CoherenceChecker {
let coherence_info = &self.crate_context.coherence_info; let coherence_info = &self.crate_context.coherence_info;
let extension_methods = &coherence_info.extension_methods; let extension_methods = &coherence_info.extension_methods;
for extension_methods.each_key |trait_id| { for extension_methods.each_key_ref |&trait_id| {
self.check_implementation_coherence_of(trait_id); self.check_implementation_coherence_of(trait_id);
} }
} }
@ -502,7 +502,7 @@ pub impl CoherenceChecker {
} }
for ty::trait_methods(tcx, trait_did).each |method| { for ty::trait_methods(tcx, trait_did).each |method| {
if provided_method_idents.contains_key(method.ident) { if provided_method_idents.contains_key_ref(&method.ident) {
if !f(method) { if !f(method) {
break; break;
} }
@ -912,7 +912,7 @@ pub impl CoherenceChecker {
let tcx = self.crate_context.tcx; let tcx = self.crate_context.tcx;
let pmm = tcx.provided_methods; let pmm = tcx.provided_methods;
if pmm.contains_key(trait_def_id) { return; } if pmm.contains_key_ref(&trait_def_id) { return; }
debug!("(adding default methods for trait) processing trait"); debug!("(adding default methods for trait) processing trait");

View file

@ -326,7 +326,7 @@ pub fn ensure_supertraits(ccx: @crate_ctxt,
rp: Option<ty::region_variance>, rp: Option<ty::region_variance>,
trait_refs: &[@ast::trait_ref]) { trait_refs: &[@ast::trait_ref]) {
let tcx = ccx.tcx; let tcx = ccx.tcx;
if tcx.supertraits.contains_key(local_def(id)) { return; } if tcx.supertraits.contains_key_ref(&local_def(id)) { return; }
let instantiated = dvec::DVec(); let instantiated = dvec::DVec();
for trait_refs.each |trait_ref| { for trait_refs.each |trait_ref| {

View file

@ -280,7 +280,7 @@ use core::result::{Result, Ok, Err, map_vec, map_vec2, iter_vec2};
use core::result; use core::result;
use core::vec; use core::vec;
use std::list::Nil; use std::list::Nil;
use std::map::HashMap; use std::oldmap::HashMap;
use std::oldsmallintmap; use std::oldsmallintmap;
use syntax::ast::{ret_style, purity}; use syntax::ast::{ret_style, purity};
use syntax::ast::{m_const, m_imm, m_mutbl}; use syntax::ast::{m_const, m_imm, m_mutbl};

View file

@ -559,7 +559,7 @@ use core::uint;
use core::vec; use core::vec;
use result::Result; use result::Result;
use result::{Ok, Err}; use result::{Ok, Err};
use std::map::HashMap; use std::oldmap::HashMap;
use std::cell::{Cell, empty_cell}; use std::cell::{Cell, empty_cell};
use std::list::{List, Nil, Cons}; use std::list::{List, Nil, Cons};
use syntax::codemap::span; use syntax::codemap::span;
@ -712,11 +712,11 @@ pub impl RegionVarBindings {
assert self.var_spans.len() == *vid + 1; assert self.var_spans.len() == *vid + 1;
self.var_spans.pop(); self.var_spans.pop();
} }
AddConstraint(constraint) => { AddConstraint(ref constraint) => {
self.constraints.remove(constraint); self.constraints.remove(constraint);
} }
AddCombination(map, ref regions) => { AddCombination(map, ref regions) => {
map.remove((*regions)); map.remove(regions);
} }
} }
} }
@ -1226,7 +1226,7 @@ impl RegionVarBindings {
fn construct_graph(&self) -> Graph { fn construct_graph(&self) -> Graph {
let num_vars = self.num_vars(); let num_vars = self.num_vars();
let num_edges = self.constraints.size(); let num_edges = self.constraints.len();
let nodes = vec::from_fn(num_vars, |var_idx| { let nodes = vec::from_fn(num_vars, |var_idx| {
GraphNode { GraphNode {

View file

@ -30,7 +30,7 @@ use std::getopts::groups;
use std::getopts::{opt_present}; use std::getopts::{opt_present};
use std::getopts; use std::getopts;
use std::getopts; use std::getopts;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::codemap::dummy_sp; use syntax::codemap::dummy_sp;
use syntax::parse::parse_crate_from_source_str; use syntax::parse::parse_crate_from_source_str;
use syntax::{ast, attr, parse}; use syntax::{ast, attr, parse};

View file

@ -67,8 +67,8 @@ use core::result;
use core::vec; use core::vec;
use std::list::{List, Nil, Cons}; use std::list::{List, Nil, Cons};
use std::list; use std::list;
use std::map::HashMap; use std::oldmap::HashMap;
use std::map; use std::oldmap;
use std::oldsmallintmap; use std::oldsmallintmap;
use syntax::ast::{provided, required}; use syntax::ast::{provided, required};
use syntax::ast_map::node_id_to_str; use syntax::ast_map::node_id_to_str;
@ -377,8 +377,8 @@ pub fn check_crate(tcx: ty::ctxt,
let ccx = @crate_ctxt_(crate_ctxt__ { let ccx = @crate_ctxt_(crate_ctxt__ {
trait_map: trait_map, trait_map: trait_map,
method_map: map::HashMap(), method_map: oldmap::HashMap(),
vtable_map: map::HashMap(), vtable_map: oldmap::HashMap(),
coherence_info: @coherence::CoherenceInfo(), coherence_info: @coherence::CoherenceInfo(),
tcx: tcx tcx: tcx
}); });

View file

@ -136,7 +136,7 @@ pub mod lib {
use result::{Ok, Err}; use result::{Ok, Err};
use io::ReaderUtil; use io::ReaderUtil;
use std::getopts; use std::getopts;
use std::map::HashMap; use std::oldmap::HashMap;
use getopts::{opt_present}; use getopts::{opt_present};
use getopts::groups; use getopts::groups;
use syntax::codemap; use syntax::codemap;
@ -177,7 +177,7 @@ Available lint options:
let lint_dict = lint::get_lint_dict(); let lint_dict = lint::get_lint_dict();
let mut max_key = 0; let mut max_key = 0;
for lint_dict.each_key |k| { max_key = uint::max(k.len(), max_key); } for lint_dict.each_key_ref |&k| { max_key = uint::max(k.len(), max_key); }
fn padded(max: uint, s: &str) -> ~str { fn padded(max: uint, s: &str) -> ~str {
str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s
} }
@ -186,7 +186,7 @@ Available lint options:
padded(max_key, ~"name"), ~"default", ~"meaning")); padded(max_key, ~"name"), ~"default", ~"meaning"));
io::println(fmt!(" %s %7.7s %s\n", io::println(fmt!(" %s %7.7s %s\n",
padded(max_key, ~"----"), ~"-------", ~"-------")); padded(max_key, ~"----"), ~"-------", ~"-------"));
for lint_dict.each |k, v| { for lint_dict.each_ref |&k, &v| {
let k = str::replace(k, ~"_", ~"-"); let k = str::replace(k, ~"_", ~"-");
io::println(fmt!(" %s %7.7s %s", io::println(fmt!(" %s %7.7s %s",
padded(max_key, k), padded(max_key, k),

View file

@ -19,7 +19,7 @@ use syntax;
use core::option; use core::option;
use core::str; use core::str;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
pub fn indent<R>(op: fn() -> R) -> R { pub fn indent<R>(op: fn() -> R) -> R {
// Use in conjunction with the log post-processor like `src/etc/indenter` // Use in conjunction with the log post-processor like `src/etc/indenter`

View file

@ -36,7 +36,7 @@ use syntax::ast_map;
use core::str; use core::str;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
pub fn note_and_explain_region(cx: ctxt, pub fn note_and_explain_region(cx: ctxt,
prefix: ~str, prefix: ~str,

View file

@ -32,7 +32,7 @@ use rustc::driver::session::{basic_options, options};
use rustc::driver::session; use rustc::driver::session;
use rustc::front; use rustc::front;
use rustc::metadata::filesearch; use rustc::metadata::filesearch;
use std::map::HashMap; use std::oldmap::HashMap;
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;
use syntax::codemap; use syntax::codemap;
@ -164,7 +164,7 @@ fn srv_should_build_ast_map() {
let source = ~"fn a() { }"; let source = ~"fn a() { }";
do from_str(source) |srv| { do from_str(source) |srv| {
do exec(srv) |ctxt| { do exec(srv) |ctxt| {
assert ctxt.ast_map.size() != 0u assert !ctxt.ast_map.is_empty()
}; };
} }
} }

View file

@ -31,7 +31,7 @@ use core::option;
use core::vec; use core::vec;
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;
use std::map::HashMap; use std::oldmap::HashMap;
use std::par; use std::par;
pub fn mk_pass() -> Pass { pub fn mk_pass() -> Pass {

View file

@ -19,7 +19,7 @@ use fold;
use pass::Pass; use pass::Pass;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
pub fn mk_pass() -> Pass { pub fn mk_pass() -> Pass {
Pass { Pass {

View file

@ -22,7 +22,7 @@ use fold;
use pass::Pass; use pass::Pass;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use std::par; use std::par;
use syntax::ast; use syntax::ast;
use syntax::print::pprust; use syntax::print::pprust;

View file

@ -1162,18 +1162,6 @@ impl <A: ToJson Copy> LinearMap<~str, A>: ToJson {
} }
} }
/*
impl <A: ToJson Copy> @std::map::HashMap<~str, A>: ToJson {
fn to_json() -> Json {
let mut d = LinearMap::new();
for self.each_ref |key, value| {
d.insert(copy *key, value.to_json());
}
Object(~d)
}
}
*/
impl <A: ToJson> Option<A>: ToJson { impl <A: ToJson> Option<A>: ToJson {
fn to_json() -> Json { fn to_json() -> Json {
match self { match self {

View file

@ -8,16 +8,16 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
//! A map type //! A map type - **deprecated**, use `core::hashmap` instead
#[forbid(deprecated_mode)]; #[forbid(deprecated_mode)];
use core::container::{Container, Mutable, Map};
use core::cmp::Eq; use core::cmp::Eq;
use core::hash::Hash; use core::hash::Hash;
use core::io::WriterUtil; use core::io::WriterUtil;
use core::io; use core::io;
use core::ops; use core::ops;
use core::to_str::ToStr; use core::to_str::ToStr;
use core::mutable::Mut;
use core::prelude::*; use core::prelude::*;
use core::to_bytes::IterBytes; use core::to_bytes::IterBytes;
use core::uint; use core::uint;
@ -28,84 +28,6 @@ pub type Set<K> = HashMap<K, ()>;
pub type HashMap<K, V> = chained::T<K, V>; pub type HashMap<K, V> = chained::T<K, V>;
pub trait StdMap<K:Eq IterBytes Hash Copy, V: Copy> {
/// Return the number of elements in the map
pure fn size() -> uint;
/**
* Add a value to the map.
*
* If the map already contains a value for the specified key then the
* original value is replaced.
*
* Returns true if the key did not already exist in the map
*/
fn insert(key: K, value: V) -> bool;
/**
* Add a value to the map.
*
* If the map contains a value for the key, use the function
* to set a new value.
*/
fn update_with_key(key: K, newval: V, ff: fn(K, V, V) -> V) -> bool;
/**
* Add a value to the map.
*
* If the map contains a value for the key, use the function to
* set a new value. (Like `update_with_key`, but with a
* function of only values.)
*/
fn update(key: K, newval: V, ff: fn(V, V) -> V) -> bool;
/// Returns true if the map contains a value for the specified key
pure fn contains_key(key: K) -> bool;
/// Returns true if the map contains a value for the specified
/// key, taking the key by reference.
pure fn contains_key_ref(key: &K) -> bool;
/**
* Get the value for the specified key. Fails if the key does not exist in
* the map.
*/
pure fn get(key: K) -> V;
/**
* Get the value for the specified key. If the key does not exist in
* the map then returns none.
*/
pure fn find(key: K) -> Option<V>;
/**
* Remove and return a value from the map. Returns true if the
* key was present in the map, otherwise false.
*/
fn remove(key: K) -> bool;
/// Clear the map, removing all key/value pairs.
fn clear();
/// Iterate over all the key/value pairs in the map by value
pure fn each(fn(key: K, value: V) -> bool);
/// Iterate over all the keys in the map by value
pure fn each_key(fn(key: K) -> bool);
/// Iterate over all the values in the map by value
pure fn each_value(fn(value: V) -> bool);
/// Iterate over all the key/value pairs in the map by reference
pure fn each_ref(fn(key: &K, value: &V) -> bool);
/// Iterate over all the keys in the map by reference
pure fn each_key_ref(fn(key: &K) -> bool);
/// Iterate over all the values in the map by reference
pure fn each_value_ref(fn(value: &V) -> bool);
}
pub mod util { pub mod util {
pub struct Rational { pub struct Rational {
// : int::positive(*.den); // : int::positive(*.den);
@ -124,7 +46,7 @@ pub mod util {
// FIXME (#2344): package this up and export it as a datatype usable for // FIXME (#2344): package this up and export it as a datatype usable for
// external code that doesn't want to pay the cost of a box. // external code that doesn't want to pay the cost of a box.
pub mod chained { pub mod chained {
use map::{StdMap, util}; use super::util;
use core::io; use core::io;
use core::ops; use core::ops;
@ -239,14 +161,20 @@ pub mod chained {
} }
} }
impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V>: StdMap<K, V> { impl<K: Eq IterBytes Hash, V> T<K, V>: Container {
pure fn size() -> uint { self.count } pure fn len(&self) -> uint { self.count }
pure fn is_empty(&self) -> bool { self.count == 0 }
}
pure fn contains_key(k: K) -> bool { impl<K: Eq IterBytes Hash, V> T<K, V>: Mutable {
self.contains_key_ref(&k) fn clear(&mut self) {
self.count = 0u;
self.chains = chains(initial_capacity);
} }
}
pure fn contains_key_ref(k: &K) -> bool { impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V> {
pure fn contains_key_ref(&self, k: &K) -> bool {
let hash = k.hash_keyed(0,0) as uint; let hash = k.hash_keyed(0,0) as uint;
match self.search_tbl(k, hash) { match self.search_tbl(k, hash) {
NotFound => false, NotFound => false,
@ -298,7 +226,7 @@ pub mod chained {
} }
} }
pure fn find(k: K) -> Option<V> { pure fn find(&self, k: K) -> Option<V> {
unsafe { unsafe {
match self.search_tbl(&k, k.hash_keyed(0,0) as uint) { match self.search_tbl(&k, k.hash_keyed(0,0) as uint) {
NotFound => None, NotFound => None,
@ -363,7 +291,7 @@ pub mod chained {
return self.update_with_key(key, newval, |_k, v, v1| ff(v,v1)); return self.update_with_key(key, newval, |_k, v, v1| ff(v,v1));
} }
pure fn get(k: K) -> V { pure fn get(&self, k: K) -> V {
let opt_v = self.find(k); let opt_v = self.find(k);
if opt_v.is_none() { if opt_v.is_none() {
die!(fmt!("Key not found in table: %?", k)); die!(fmt!("Key not found in table: %?", k));
@ -371,8 +299,8 @@ pub mod chained {
option::unwrap(move opt_v) option::unwrap(move opt_v)
} }
fn remove(k: K) -> bool { fn remove(k: &K) -> bool {
match self.search_tbl(&k, k.hash_keyed(0,0) as uint) { match self.search_tbl(k, k.hash_keyed(0,0) as uint) {
NotFound => false, NotFound => false,
FoundFirst(idx, entry) => { FoundFirst(idx, entry) => {
self.count -= 1u; self.count -= 1u;
@ -387,34 +315,17 @@ pub mod chained {
} }
} }
fn clear() { pure fn each_ref(&self, blk: fn(key: &K, value: &V) -> bool) {
self.count = 0u;
self.chains = chains(initial_capacity);
}
pure fn each(blk: fn(key: K, value: V) -> bool) {
self.each_ref(|k, v| blk(*k, *v))
}
pure fn each_key(blk: fn(key: K) -> bool) {
self.each_key_ref(|p| blk(*p))
}
pure fn each_value(blk: fn(value: V) -> bool) {
self.each_value_ref(|p| blk(*p))
}
pure fn each_ref(blk: fn(key: &K, value: &V) -> bool) {
for self.each_entry |entry| { for self.each_entry |entry| {
if !blk(&entry.key, &entry.value) { break; } if !blk(&entry.key, &entry.value) { break; }
} }
} }
pure fn each_key_ref(blk: fn(key: &K) -> bool) { pure fn each_key_ref(&self, blk: fn(key: &K) -> bool) {
self.each_ref(|k, _v| blk(k)) self.each_ref(|k, _v| blk(k))
} }
pure fn each_value_ref(blk: fn(value: &V) -> bool) { pure fn each_value_ref(&self, blk: fn(value: &V) -> bool) {
self.each_ref(|_k, v| blk(v)) self.each_ref(|_k, v| blk(v))
} }
} }
@ -486,8 +397,8 @@ pub fn set_add<K:Eq IterBytes Hash Const Copy>(set: Set<K>, key: K) -> bool {
/// Convert a set into a vector. /// Convert a set into a vector.
pub pure fn vec_from_set<T:Eq IterBytes Hash Copy>(s: Set<T>) -> ~[T] { pub pure fn vec_from_set<T:Eq IterBytes Hash Copy>(s: Set<T>) -> ~[T] {
do vec::build_sized(s.size()) |push| { do vec::build_sized(s.len()) |push| {
for s.each_key() |k| { for s.each_key_ref() |&k| {
push(k); push(k);
} }
} }
@ -509,20 +420,20 @@ pub fn hash_from_vec<K: Eq IterBytes Hash Const Copy, V: Copy>(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use map;
use core::option::None; use core::option::None;
use core::option; use core::option;
use core::uint; use core::uint;
use super::*;
#[test] #[test]
fn test_simple() { fn test_simple() {
debug!("*** starting test_simple"); debug!("*** starting test_simple");
pure fn eq_uint(x: &uint, y: &uint) -> bool { *x == *y } pure fn eq_uint(x: &uint, y: &uint) -> bool { *x == *y }
pure fn uint_id(x: &uint) -> uint { *x } pure fn uint_id(x: &uint) -> uint { *x }
debug!("uint -> uint"); debug!("uint -> uint");
let hm_uu: map::HashMap<uint, uint> = let hm_uu: HashMap<uint, uint> =
map::HashMap::<uint, uint>(); HashMap::<uint, uint>();
assert (hm_uu.insert(10u, 12u)); assert (hm_uu.insert(10u, 12u));
assert (hm_uu.insert(11u, 13u)); assert (hm_uu.insert(11u, 13u));
assert (hm_uu.insert(12u, 14u)); assert (hm_uu.insert(12u, 14u));
@ -537,8 +448,8 @@ mod tests {
let eleven: ~str = ~"eleven"; let eleven: ~str = ~"eleven";
let twelve: ~str = ~"twelve"; let twelve: ~str = ~"twelve";
debug!("str -> uint"); debug!("str -> uint");
let hm_su: map::HashMap<~str, uint> = let hm_su: HashMap<~str, uint> =
map::HashMap::<~str, uint>(); HashMap::<~str, uint>();
assert (hm_su.insert(~"ten", 12u)); assert (hm_su.insert(~"ten", 12u));
assert (hm_su.insert(eleven, 13u)); assert (hm_su.insert(eleven, 13u));
assert (hm_su.insert(~"twelve", 14u)); assert (hm_su.insert(~"twelve", 14u));
@ -551,8 +462,8 @@ mod tests {
assert (!hm_su.insert(~"twelve", 12u)); assert (!hm_su.insert(~"twelve", 12u));
assert (hm_su.get(~"twelve") == 12u); assert (hm_su.get(~"twelve") == 12u);
debug!("uint -> str"); debug!("uint -> str");
let hm_us: map::HashMap<uint, ~str> = let hm_us: HashMap<uint, ~str> =
map::HashMap::<uint, ~str>(); HashMap::<uint, ~str>();
assert (hm_us.insert(10u, ~"twelve")); assert (hm_us.insert(10u, ~"twelve"));
assert (hm_us.insert(11u, ~"thirteen")); assert (hm_us.insert(11u, ~"thirteen"));
assert (hm_us.insert(12u, ~"fourteen")); assert (hm_us.insert(12u, ~"fourteen"));
@ -564,8 +475,8 @@ mod tests {
assert (!hm_us.insert(12u, ~"twelve")); assert (!hm_us.insert(12u, ~"twelve"));
assert hm_us.get(12u) == ~"twelve"; assert hm_us.get(12u) == ~"twelve";
debug!("str -> str"); debug!("str -> str");
let hm_ss: map::HashMap<~str, ~str> = let hm_ss: HashMap<~str, ~str> =
map::HashMap::<~str, ~str>(); HashMap::<~str, ~str>();
assert (hm_ss.insert(ten, ~"twelve")); assert (hm_ss.insert(ten, ~"twelve"));
assert (hm_ss.insert(eleven, ~"thirteen")); assert (hm_ss.insert(eleven, ~"thirteen"));
assert (hm_ss.insert(twelve, ~"fourteen")); assert (hm_ss.insert(twelve, ~"fourteen"));
@ -590,8 +501,8 @@ mod tests {
pure fn eq_uint(x: &uint, y: &uint) -> bool { *x == *y } pure fn eq_uint(x: &uint, y: &uint) -> bool { *x == *y }
pure fn uint_id(x: &uint) -> uint { *x } pure fn uint_id(x: &uint) -> uint { *x }
debug!("uint -> uint"); debug!("uint -> uint");
let hm_uu: map::HashMap<uint, uint> = let hm_uu: HashMap<uint, uint> =
map::HashMap::<uint, uint>(); HashMap::<uint, uint>();
let mut i: uint = 0u; let mut i: uint = 0u;
while i < num_to_insert { while i < num_to_insert {
assert (hm_uu.insert(i, i * i)); assert (hm_uu.insert(i, i * i));
@ -615,8 +526,8 @@ mod tests {
i += 1u; i += 1u;
} }
debug!("str -> str"); debug!("str -> str");
let hm_ss: map::HashMap<~str, ~str> = let hm_ss: HashMap<~str, ~str> =
map::HashMap::<~str, ~str>(); HashMap::<~str, ~str>();
i = 0u; i = 0u;
while i < num_to_insert { while i < num_to_insert {
assert hm_ss.insert(uint::to_str_radix(i, 2u), assert hm_ss.insert(uint::to_str_radix(i, 2u),
@ -657,24 +568,24 @@ mod tests {
fn test_removal() { fn test_removal() {
debug!("*** starting test_removal"); debug!("*** starting test_removal");
let num_to_insert: uint = 64u; let num_to_insert: uint = 64u;
let hm: map::HashMap<uint, uint> = let hm: HashMap<uint, uint> =
map::HashMap::<uint, uint>(); HashMap::<uint, uint>();
let mut i: uint = 0u; let mut i: uint = 0u;
while i < num_to_insert { while i < num_to_insert {
assert (hm.insert(i, i * i)); assert (hm.insert(i, i * i));
debug!("inserting %u -> %u", i, i*i); debug!("inserting %u -> %u", i, i*i);
i += 1u; i += 1u;
} }
assert (hm.size() == num_to_insert); assert (hm.len() == num_to_insert);
debug!("-----"); debug!("-----");
debug!("removing evens"); debug!("removing evens");
i = 0u; i = 0u;
while i < num_to_insert { while i < num_to_insert {
let v = hm.remove(i); let v = hm.remove(&i);
assert v; assert v;
i += 2u; i += 2u;
} }
assert (hm.size() == num_to_insert / 2u); assert (hm.len() == num_to_insert / 2u);
debug!("-----"); debug!("-----");
i = 1u; i = 1u;
while i < num_to_insert { while i < num_to_insert {
@ -696,7 +607,7 @@ mod tests {
debug!("inserting %u -> %u", i, i*i); debug!("inserting %u -> %u", i, i*i);
i += 2u; i += 2u;
} }
assert (hm.size() == num_to_insert); assert (hm.len() == num_to_insert);
debug!("-----"); debug!("-----");
i = 0u; i = 0u;
while i < num_to_insert { while i < num_to_insert {
@ -705,7 +616,7 @@ mod tests {
i += 1u; i += 1u;
} }
debug!("-----"); debug!("-----");
assert (hm.size() == num_to_insert); assert (hm.len() == num_to_insert);
i = 0u; i = 0u;
while i < num_to_insert { while i < num_to_insert {
debug!("get(%u) = %u", i, hm.get(i)); debug!("get(%u) = %u", i, hm.get(i));
@ -718,16 +629,16 @@ mod tests {
#[test] #[test]
fn test_contains_key() { fn test_contains_key() {
let key = ~"k"; let key = ~"k";
let map = map::HashMap::<~str, ~str>(); let map = HashMap::<~str, ~str>();
assert (!map.contains_key(key)); assert (!map.contains_key_ref(&key));
map.insert(key, ~"val"); map.insert(key, ~"val");
assert (map.contains_key(key)); assert (map.contains_key_ref(&key));
} }
#[test] #[test]
fn test_find() { fn test_find() {
let key = ~"k"; let key = ~"k";
let map = map::HashMap::<~str, ~str>(); let map = HashMap::<~str, ~str>();
assert (option::is_none(&map.find(key))); assert (option::is_none(&map.find(key)));
map.insert(key, ~"val"); map.insert(key, ~"val");
assert (option::get(map.find(key)) == ~"val"); assert (option::get(map.find(key)) == ~"val");
@ -736,23 +647,23 @@ mod tests {
#[test] #[test]
fn test_clear() { fn test_clear() {
let key = ~"k"; let key = ~"k";
let map = map::HashMap::<~str, ~str>(); let mut map = HashMap::<~str, ~str>();
map.insert(key, ~"val"); map.insert(key, ~"val");
assert (map.size() == 1); assert (map.len() == 1);
assert (map.contains_key(key)); assert (map.contains_key_ref(&key));
map.clear(); map.clear();
assert (map.size() == 0); assert (map.len() == 0);
assert (!map.contains_key(key)); assert (!map.contains_key_ref(&key));
} }
#[test] #[test]
fn test_hash_from_vec() { fn test_hash_from_vec() {
let map = map::hash_from_vec(~[ let map = hash_from_vec(~[
(~"a", 1), (~"a", 1),
(~"b", 2), (~"b", 2),
(~"c", 3) (~"c", 3)
]); ]);
assert map.size() == 3u; assert map.len() == 3u;
assert map.get(~"a") == 1; assert map.get(~"a") == 1;
assert map.get(~"b") == 2; assert map.get(~"b") == 2;
assert map.get(~"c") == 3; assert map.get(~"c") == 3;
@ -760,7 +671,7 @@ mod tests {
#[test] #[test]
fn test_update_with_key() { fn test_update_with_key() {
let map = map::HashMap::<~str, uint>(); let map = HashMap::<~str, uint>();
// given a new key, initialize it with this new count, given // given a new key, initialize it with this new count, given
// given an existing key, add more to its count // given an existing key, add more to its count

View file

@ -79,7 +79,7 @@ pub mod bitv;
pub mod deque; pub mod deque;
pub mod fun_treemap; pub mod fun_treemap;
pub mod list; pub mod list;
pub mod map; pub mod oldmap;
pub mod priority_queue; pub mod priority_queue;
pub mod rope; pub mod rope;
pub mod smallintmap; pub mod smallintmap;

View file

@ -25,8 +25,8 @@ use core::cmp;
use core::either; use core::either;
use core::str; use core::str;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use std::map; use std::oldmap;
use std; use std;
pub enum path_elt { pub enum path_elt {
@ -106,7 +106,7 @@ pub enum ast_node {
node_struct_ctor(@struct_def, @item, @path), node_struct_ctor(@struct_def, @item, @path),
} }
pub type map = std::map::HashMap<node_id, ast_node>; pub type map = std::oldmap::HashMap<node_id, ast_node>;
pub struct ctx { pub struct ctx {
map: map, map: map,
mut path: path, mut path: path,
@ -134,7 +134,7 @@ pub fn mk_ast_map_visitor() -> vt {
pub fn map_crate(diag: span_handler, c: crate) -> map { pub fn map_crate(diag: span_handler, c: crate) -> map {
let cx = ctx { let cx = ctx {
map: std::map::HashMap(), map: std::oldmap::HashMap(),
mut path: ~[], mut path: ~[],
mut local_id: 0u, mut local_id: 0u,
diag: diag, diag: diag,

View file

@ -24,8 +24,8 @@ use core::either::Either;
use core::either; use core::either;
use core::option; use core::option;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
use std::map; use std::oldmap;
use std; use std;
/* Constructors */ /* Constructors */
@ -358,12 +358,12 @@ pub fn find_inline_attr(attrs: &[ast::attribute]) -> inline_attr {
pub fn require_unique_names(diagnostic: span_handler, pub fn require_unique_names(diagnostic: span_handler,
metas: &[@ast::meta_item]) { metas: &[@ast::meta_item]) {
let map = map::HashMap(); let map = oldmap::HashMap();
for metas.each |meta| { for metas.each |meta| {
let name = get_meta_item_name(*meta); let name = get_meta_item_name(*meta);
// FIXME: How do I silence the warnings? --pcw (#2619) // FIXME: How do I silence the warnings? --pcw (#2619)
if map.contains_key(name) { if map.contains_key_ref(&name) {
diagnostic.span_fatal(meta.span, diagnostic.span_fatal(meta.span,
fmt!("duplicate meta item `%s`", name)); fmt!("duplicate meta item `%s`", name));
} }

View file

@ -98,8 +98,8 @@ use ext::base::*;
use parse; use parse;
use core::vec; use core::vec;
use std::map; use std::oldmap;
use std::map::HashMap; use std::oldmap::HashMap;
// Transitional reexports so qquote can find the paths it is looking for // Transitional reexports so qquote can find the paths it is looking for
mod syntax { mod syntax {

View file

@ -20,7 +20,7 @@ use parse::{parser, token};
use core::io; use core::io;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
// new-style macro! tt code: // new-style macro! tt code:
// //

View file

@ -20,7 +20,7 @@ use parse::{parser, parse_expr_from_source_str, new_parser_from_tts};
use core::option; use core::option;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
pub fn expand_expr(exts: HashMap<~str, SyntaxExtension>, cx: ext_ctxt, pub fn expand_expr(exts: HashMap<~str, SyntaxExtension>, cx: ext_ctxt,
e: expr_, s: span, fld: ast_fold, e: expr_, s: span, fld: ast_fold,

View file

@ -26,7 +26,7 @@ use core::option;
use core::str; use core::str;
use core::uint; use core::uint;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
/* This is an Earley-like parser, without support for in-grammar nonterminals, /* 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 only by calling out to the main rust parser for named nonterminals (which it
@ -197,7 +197,7 @@ pub fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
codemap::spanned { codemap::spanned {
node: match_nonterminal(bind_name, _, idx), span: sp node: match_nonterminal(bind_name, _, idx), span: sp
} => { } => {
if ret_val.contains_key(bind_name) { if ret_val.contains_key_ref(&bind_name) {
p_s.span_diagnostic.span_fatal(sp, ~"Duplicated bind name: "+ p_s.span_diagnostic.span_fatal(sp, ~"Duplicated bind name: "+
*p_s.interner.get(bind_name)) *p_s.interner.get(bind_name))
} }

View file

@ -26,7 +26,7 @@ use parse::token::{FAT_ARROW, SEMI, LBRACE, RBRACE, nt_matchers, nt_tt};
use print; use print;
use core::io; use core::io;
use std::map::HashMap; use std::oldmap::HashMap;
pub fn add_new_extension(cx: ext_ctxt, sp: span, name: ident, pub fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
arg: ~[ast::token_tree]) -> base::MacResult { arg: ~[ast::token_tree]) -> base::MacResult {

View file

@ -22,7 +22,7 @@ use parse::lexer::TokenAndSpan;
use core::option; use core::option;
use core::vec; use core::vec;
use std; use std;
use std::map::HashMap; use std::oldmap::HashMap;
enum tt_frame_up { /* to break a circularity */ enum tt_frame_up { /* to break a circularity */
tt_frame_up(Option<tt_frame>) tt_frame_up(Option<tt_frame>)
@ -44,7 +44,7 @@ pub type tt_reader = @{
interner: @ident_interner, interner: @ident_interner,
mut cur: tt_frame, mut cur: tt_frame,
/* for MBE-style macro transcription */ /* for MBE-style macro transcription */
interpolations: std::map::HashMap<ident, @named_match>, interpolations: std::oldmap::HashMap<ident, @named_match>,
mut repeat_idx: ~[uint], mut repeat_idx: ~[uint],
mut repeat_len: ~[uint], mut repeat_len: ~[uint],
/* cached: */ /* cached: */
@ -56,14 +56,14 @@ pub type tt_reader = @{
* `src` contains no `tt_seq`s and `tt_nonterminal`s, `interp` can (and * `src` contains no `tt_seq`s and `tt_nonterminal`s, `interp` can (and
* should) be none. */ * should) be none. */
pub fn new_tt_reader(sp_diag: span_handler, itr: @ident_interner, pub fn new_tt_reader(sp_diag: span_handler, itr: @ident_interner,
interp: Option<std::map::HashMap<ident,@named_match>>, interp: Option<std::oldmap::HashMap<ident,@named_match>>,
src: ~[ast::token_tree]) src: ~[ast::token_tree])
-> tt_reader { -> tt_reader {
let r = @{sp_diag: sp_diag, interner: itr, let r = @{sp_diag: sp_diag, interner: itr,
mut cur: @{readme: src, mut idx: 0u, dotdotdoted: false, mut cur: @{readme: src, mut idx: 0u, dotdotdoted: false,
sep: None, up: tt_frame_up(option::None)}, sep: None, up: tt_frame_up(option::None)},
interpolations: match interp { /* just a convienience */ interpolations: match interp { /* just a convienience */
None => std::map::HashMap(), None => std::oldmap::HashMap(),
Some(x) => x Some(x) => x
}, },
mut repeat_idx: ~[], mut repeat_idx: ~[],

View file

@ -18,7 +18,7 @@ use parse::token;
use core::option::{None, Option, Some}; use core::option::{None, Option, Some};
use core::option; use core::option;
use std::map::HashMap; use std::oldmap::HashMap;
pub type seq_sep = { pub type seq_sep = {
sep: Option<token::Token>, sep: Option<token::Token>,

View file

@ -137,7 +137,7 @@ pub impl Parser {
desc: &str) { desc: &str) {
self.span_err(sp, fmt!("obsolete syntax: %s", kind_str)); self.span_err(sp, fmt!("obsolete syntax: %s", kind_str));
if !self.obsolete_set.contains_key(kind) { if !self.obsolete_set.contains_key_ref(&kind) {
self.sess.span_diagnostic.handler().note(fmt!("%s", desc)); self.sess.span_diagnostic.handler().note(fmt!("%s", desc));
self.obsolete_set.insert(kind, ()); self.obsolete_set.insert(kind, ());
} }

View file

@ -87,7 +87,7 @@ use core::either;
use core::result::Result; use core::result::Result;
use core::vec::push; use core::vec::push;
use core::vec; use core::vec;
use std::map::HashMap; use std::oldmap::HashMap;
#[deriving_eq] #[deriving_eq]
enum restriction { enum restriction {

View file

@ -21,7 +21,7 @@ use core::char;
use core::cmp; use core::cmp;
use core::str; use core::str;
use core::task; use core::task;
use std::map::HashMap; use std::oldmap::HashMap;
#[auto_encode] #[auto_encode]
#[auto_decode] #[auto_decode]
@ -454,13 +454,13 @@ pub fn mk_fake_ident_interner() -> @ident_interner {
*/ */
pub fn keyword_table() -> HashMap<~str, ()> { pub fn keyword_table() -> HashMap<~str, ()> {
let keywords = HashMap(); let keywords = HashMap();
for temporary_keyword_table().each_key |word| { for temporary_keyword_table().each_key_ref |&word| {
keywords.insert(word, ()); keywords.insert(word, ());
} }
for strict_keyword_table().each_key |word| { for strict_keyword_table().each_key_ref |&word| {
keywords.insert(word, ()); keywords.insert(word, ());
} }
for reserved_keyword_table().each_key |word| { for reserved_keyword_table().each_key_ref |&word| {
keywords.insert(word, ()); keywords.insert(word, ());
} }
keywords keywords

View file

@ -15,13 +15,13 @@
use core::prelude::*; use core::prelude::*;
use core::dvec::DVec; use core::dvec::DVec;
use std::map::HashMap; use std::oldmap::HashMap;
use std::map; use std::oldmap;
pub type hash_interner<T> = {map: HashMap<T, uint>, vect: DVec<T>}; pub type hash_interner<T> = {map: HashMap<T, uint>, vect: DVec<T>};
pub fn mk<T:Eq IterBytes Hash Const Copy>() -> Interner<T> { pub fn mk<T:Eq IterBytes Hash Const Copy>() -> Interner<T> {
let m = map::HashMap::<T, uint>(); let m = oldmap::HashMap::<T, uint>();
let hi: hash_interner<T> = let hi: hash_interner<T> =
{map: m, vect: DVec()}; {map: m, vect: DVec()};
move ((move hi) as Interner::<T>) move ((move hi) as Interner::<T>)

View file

@ -14,7 +14,7 @@
extern mod std; extern mod std;
use core::dvec::*; use core::dvec::*;
use std::map::HashMap; use std::oldmap::HashMap;
pub type header_map = HashMap<~str, @DVec<@~str>>; pub type header_map = HashMap<~str, @DVec<@~str>>;

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
extern mod std; extern mod std;
use std::map; use std::oldmap;
use std::treemap::TreeMap; use std::treemap::TreeMap;
use core::hashmap::linear::*; use core::hashmap::linear::*;
use core::io::WriterUtil; use core::io::WriterUtil;
@ -35,7 +35,7 @@ fn timed(result: &mut float,
fn old_int_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) { fn old_int_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) {
{ {
let map = map::HashMap(); let map = oldmap::HashMap();
do timed(&mut results.sequential_ints) { do timed(&mut results.sequential_ints) {
for uint::range(0, num_keys) |i| { for uint::range(0, num_keys) |i| {
map.insert(i, i+1); map.insert(i, i+1);
@ -48,7 +48,7 @@ fn old_int_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) {
} }
{ {
let map = map::HashMap(); let map = oldmap::HashMap();
do timed(&mut results.random_ints) { do timed(&mut results.random_ints) {
for uint::range(0, num_keys) |i| { for uint::range(0, num_keys) |i| {
map.insert(rng.next() as uint, i); map.insert(rng.next() as uint, i);
@ -57,14 +57,14 @@ fn old_int_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) {
} }
{ {
let map = map::HashMap(); let map = oldmap::HashMap();
for uint::range(0, num_keys) |i| { for uint::range(0, num_keys) |i| {
map.insert(i, i);; map.insert(i, i);;
} }
do timed(&mut results.delete_ints) { do timed(&mut results.delete_ints) {
for uint::range(0, num_keys) |i| { for uint::range(0, num_keys) |i| {
assert map.remove(i); assert map.remove(&i);
} }
} }
} }
@ -72,7 +72,7 @@ fn old_int_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) {
fn old_str_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) { fn old_str_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) {
{ {
let map = map::HashMap(); let map = oldmap::HashMap();
do timed(&mut results.sequential_strings) { do timed(&mut results.sequential_strings) {
for uint::range(0, num_keys) |i| { for uint::range(0, num_keys) |i| {
let s = uint::to_str(i); let s = uint::to_str(i);
@ -87,7 +87,7 @@ fn old_str_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) {
} }
{ {
let map = map::HashMap(); let map = oldmap::HashMap();
do timed(&mut results.random_strings) { do timed(&mut results.random_strings) {
for uint::range(0, num_keys) |i| { for uint::range(0, num_keys) |i| {
let s = uint::to_str(rng.next() as uint); let s = uint::to_str(rng.next() as uint);
@ -97,13 +97,13 @@ fn old_str_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) {
} }
{ {
let map = map::HashMap(); let map = oldmap::HashMap();
for uint::range(0, num_keys) |i| { for uint::range(0, num_keys) |i| {
map.insert(uint::to_str(i), i); map.insert(uint::to_str(i), i);
} }
do timed(&mut results.delete_strings) { do timed(&mut results.delete_strings) {
for uint::range(0, num_keys) |i| { for uint::range(0, num_keys) |i| {
assert map.remove(uint::to_str(i)); assert map.remove(&uint::to_str(i));
} }
} }
} }
@ -309,7 +309,7 @@ fn main() {
let mut results = empty_results(); let mut results = empty_results();
old_int_benchmarks(rng, num_keys, &mut results); old_int_benchmarks(rng, num_keys, &mut results);
old_str_benchmarks(rng, num_keys, &mut results); old_str_benchmarks(rng, num_keys, &mut results);
write_results("std::map::HashMap", &results); write_results("std::oldmap::HashMap", &results);
} }
{ {

View file

@ -13,8 +13,8 @@
extern mod std; extern mod std;
use std::time::precise_time_s; use std::time::precise_time_s;
use std::map; use std::oldmap;
use std::map::{Map, HashMap}; use std::oldmap::{Map, HashMap};
use io::{Reader, ReaderUtil}; use io::{Reader, ReaderUtil};
@ -75,12 +75,12 @@ fn read_line() {
fn str_set() { fn str_set() {
let r = rand::Rng(); let r = rand::Rng();
let s = map::HashMap(); let s = oldmap::HashMap();
for int::range(0, 1000) |_i| { for int::range(0, 1000) |_i| {
map::set_add(s, r.gen_str(10)); oldmap::set_add(s, r.gen_str(10));
} }
let mut found = 0; let mut found = 0;
for int::range(0, 1000) |_i| { for int::range(0, 1000) |_i| {
match s.find(r.gen_str(10)) { match s.find(r.gen_str(10)) {
@ -93,7 +93,7 @@ fn str_set() {
fn vec_plus() { fn vec_plus() {
let r = rand::Rng(); let r = rand::Rng();
let mut v = ~[]; let mut v = ~[];
let mut i = 0; let mut i = 0;
while i < 1500 { while i < 1500 {
let rv = vec::from_elem(r.gen_uint_range(0, i + 1), i); let rv = vec::from_elem(r.gen_uint_range(0, i + 1), i);

View file

@ -19,9 +19,9 @@ An implementation of the Graph500 Breadth First Search problem in Rust.
extern mod std; extern mod std;
use std::arc; use std::arc;
use std::time; use std::time;
use std::map; use std::oldmap;
use std::map::Map; use std::oldmap::Map;
use std::map::HashMap; use std::oldmap::HashMap;
use std::deque; use std::deque;
use std::deque::Deque; use std::deque::Deque;
use std::par; use std::par;
@ -41,7 +41,7 @@ fn make_edges(scale: uint, edgefactor: uint) -> ~[(node_id, node_id)] {
let A = 0.57; let A = 0.57;
let B = 0.19; let B = 0.19;
let C = 0.19; let C = 0.19;
if scale == 0u { if scale == 0u {
(i, j) (i, j)
} }
@ -49,7 +49,7 @@ fn make_edges(scale: uint, edgefactor: uint) -> ~[(node_id, node_id)] {
let i = i * 2i64; let i = i * 2i64;
let j = j * 2i64; let j = j * 2i64;
let scale = scale - 1u; let scale = scale - 1u;
let x = r.gen_float(); let x = r.gen_float();
if x < A { if x < A {
@ -80,38 +80,38 @@ fn make_edges(scale: uint, edgefactor: uint) -> ~[(node_id, node_id)] {
fn make_graph(N: uint, edges: ~[(node_id, node_id)]) -> graph { fn make_graph(N: uint, edges: ~[(node_id, node_id)]) -> graph {
let graph = do vec::from_fn(N) |_i| { let graph = do vec::from_fn(N) |_i| {
map::HashMap::<node_id, ()>() oldmap::HashMap::<node_id, ()>()
}; };
do vec::each(edges) |e| { do vec::each(edges) |e| {
match *e { match *e {
(i, j) => { (i, j) => {
map::set_add(graph[i], j); oldmap::set_add(graph[i], j);
map::set_add(graph[j], i); oldmap::set_add(graph[j], i);
} }
} }
true true
} }
do graph.map() |v| { do graph.map() |v| {
map::vec_from_set(*v) oldmap::vec_from_set(*v)
} }
} }
fn gen_search_keys(graph: graph, n: uint) -> ~[node_id] { fn gen_search_keys(graph: graph, n: uint) -> ~[node_id] {
let keys = map::HashMap::<node_id, ()>(); let keys = oldmap::HashMap::<node_id, ()>();
let r = rand::Rng(); let r = rand::Rng();
while keys.size() < n { while keys.len() < n {
let k = r.gen_uint_range(0u, graph.len()); let k = r.gen_uint_range(0u, graph.len());
if graph[k].len() > 0u && vec::any(graph[k], |i| { if graph[k].len() > 0u && vec::any(graph[k], |i| {
*i != k as node_id *i != k as node_id
}) { }) {
map::set_add(keys, k as node_id); oldmap::set_add(keys, k as node_id);
} }
} }
map::vec_from_set(keys) oldmap::vec_from_set(keys)
} }
/** /**
@ -120,7 +120,7 @@ fn gen_search_keys(graph: graph, n: uint) -> ~[node_id] {
* Nodes that are unreachable have a parent of -1. * Nodes that are unreachable have a parent of -1.
*/ */
fn bfs(graph: graph, key: node_id) -> bfs_result { fn bfs(graph: graph, key: node_id) -> bfs_result {
let marks : ~[mut node_id] let marks : ~[mut node_id]
= vec::cast_to_mut(vec::from_elem(vec::len(graph), -1i64)); = vec::cast_to_mut(vec::from_elem(vec::len(graph), -1i64));
let Q = deque::create(); let Q = deque::create();
@ -300,7 +300,7 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
} }
/// Performs at least some of the validation in the Graph500 spec. /// Performs at least some of the validation in the Graph500 spec.
fn validate(edges: ~[(node_id, node_id)], fn validate(edges: ~[(node_id, node_id)],
root: node_id, tree: bfs_result) -> bool { root: node_id, tree: bfs_result) -> bool {
// There are 5 things to test. Below is code for each of them. // There are 5 things to test. Below is code for each of them.
@ -336,7 +336,7 @@ fn validate(edges: ~[(node_id, node_id)],
path.len() as int path.len() as int
} }
}; };
if !status { return status } if !status { return status }
// 2. Each tree edge connects vertices whose BFS levels differ by // 2. Each tree edge connects vertices whose BFS levels differ by
@ -366,7 +366,7 @@ fn validate(edges: ~[(node_id, node_id)],
abs(level[u] - level[v]) <= 1 abs(level[u] - level[v]) <= 1
}; };
if !status { return status } if !status { return status }
// 4. The BFS tree spans an entire connected component's vertices. // 4. The BFS tree spans an entire connected component's vertices.
@ -388,7 +388,7 @@ fn validate(edges: ~[(node_id, node_id)],
} }
}; };
if !status { return status } if !status { return status }
// If we get through here, all the tests passed! // If we get through here, all the tests passed!
true true
@ -440,44 +440,44 @@ fn main() {
let start = time::precise_time_s(); let start = time::precise_time_s();
let bfs_tree = bfs(copy graph, *root); let bfs_tree = bfs(copy graph, *root);
let stop = time::precise_time_s(); let stop = time::precise_time_s();
//total_seq += stop - start; //total_seq += stop - start;
io::stdout().write_line( io::stdout().write_line(
fmt!("Sequential BFS completed in %? seconds.", fmt!("Sequential BFS completed in %? seconds.",
stop - start)); stop - start));
if do_validate { if do_validate {
let start = time::precise_time_s(); let start = time::precise_time_s();
assert(validate(copy edges, *root, bfs_tree)); assert(validate(copy edges, *root, bfs_tree));
let stop = time::precise_time_s(); let stop = time::precise_time_s();
io::stdout().write_line( io::stdout().write_line(
fmt!("Validation completed in %? seconds.", fmt!("Validation completed in %? seconds.",
stop - start)); stop - start));
} }
let start = time::precise_time_s(); let start = time::precise_time_s();
let bfs_tree = bfs2(copy graph, *root); let bfs_tree = bfs2(copy graph, *root);
let stop = time::precise_time_s(); let stop = time::precise_time_s();
total_seq += stop - start; total_seq += stop - start;
io::stdout().write_line( io::stdout().write_line(
fmt!("Alternate Sequential BFS completed in %? seconds.", fmt!("Alternate Sequential BFS completed in %? seconds.",
stop - start)); stop - start));
if do_validate { if do_validate {
let start = time::precise_time_s(); let start = time::precise_time_s();
assert(validate(copy edges, *root, bfs_tree)); assert(validate(copy edges, *root, bfs_tree));
let stop = time::precise_time_s(); let stop = time::precise_time_s();
io::stdout().write_line( io::stdout().write_line(
fmt!("Validation completed in %? seconds.", fmt!("Validation completed in %? seconds.",
stop - start)); stop - start));
} }
} }
let start = time::precise_time_s(); let start = time::precise_time_s();
let bfs_tree = pbfs(graph_arc, *root); let bfs_tree = pbfs(graph_arc, *root);
let stop = time::precise_time_s(); let stop = time::precise_time_s();
@ -491,7 +491,7 @@ fn main() {
let start = time::precise_time_s(); let start = time::precise_time_s();
assert(validate(copy edges, *root, bfs_tree)); assert(validate(copy edges, *root, bfs_tree));
let stop = time::precise_time_s(); let stop = time::precise_time_s();
io::stdout().write_line(fmt!("Validation completed in %? seconds.", io::stdout().write_line(fmt!("Validation completed in %? seconds.",
stop - start)); stop - start));
} }

View file

@ -11,8 +11,8 @@
// chameneos // chameneos
extern mod std; extern mod std;
use std::map; use std::oldmap;
use std::map::HashMap; use std::oldmap::HashMap;
use std::sort; use std::sort;
use std::cell::Cell; use std::cell::Cell;
use core::pipes::*; use core::pipes::*;

View file

@ -14,15 +14,15 @@
#[legacy_modes]; #[legacy_modes];
extern mod std; extern mod std;
use std::map; use std::oldmap;
use std::map::HashMap; use std::oldmap::HashMap;
use std::sort; use std::sort;
use io::ReaderUtil; use io::ReaderUtil;
use pipes::{stream, Port, Chan}; use pipes::{stream, Port, Chan};
use cmp::Ord; use cmp::Ord;
// given a map, print a sorted version of it // given a map, print a sorted version of it
fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str { fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str {
fn pct(xx: uint, yy: uint) -> float { fn pct(xx: uint, yy: uint) -> float {
return (xx as float) * 100f / (yy as float); return (xx as float) * 100f / (yy as float);
} }
@ -49,10 +49,9 @@ fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str {
let mut pairs = ~[]; let mut pairs = ~[];
// map -> [(k,%)] // map -> [(k,%)]
mm.each(fn&(key: ~[u8], val: uint) -> bool { for mm.each_ref |&key, &val| {
pairs.push((key, pct(val, total))); pairs.push((key, pct(val, total)));
return true; }
});
let pairs_sorted = sortKV(pairs); let pairs_sorted = sortKV(pairs);
@ -95,13 +94,13 @@ fn windows_with_carry(bb: &[u8], nn: uint,
ii += 1u; ii += 1u;
} }
return vec::slice(bb, len - (nn - 1u), len); return vec::slice(bb, len - (nn - 1u), len);
} }
fn make_sequence_processor(sz: uint, from_parent: pipes::Port<~[u8]>, fn make_sequence_processor(sz: uint, from_parent: pipes::Port<~[u8]>,
to_parent: pipes::Chan<~str>) { to_parent: pipes::Chan<~str>) {
let freqs: HashMap<~[u8], uint> = map::HashMap(); let freqs: HashMap<~[u8], uint> = oldmap::HashMap();
let mut carry: ~[u8] = ~[]; let mut carry: ~[u8] = ~[];
let mut total: uint = 0u; let mut total: uint = 0u;
@ -118,7 +117,7 @@ fn make_sequence_processor(sz: uint, from_parent: pipes::Port<~[u8]>,
}); });
} }
let buffer = match sz { let buffer = match sz {
1u => { sort_and_fmt(freqs, total) } 1u => { sort_and_fmt(freqs, total) }
2u => { sort_and_fmt(freqs, total) } 2u => { sort_and_fmt(freqs, total) }
3u => { fmt!("%u\t%s", find(freqs, ~"GGT"), ~"GGT") } 3u => { fmt!("%u\t%s", find(freqs, ~"GGT"), ~"GGT") }
@ -165,11 +164,11 @@ fn main() {
do task::spawn_with(move from_parent) |move to_parent_, from_parent| { do task::spawn_with(move from_parent) |move to_parent_, from_parent| {
make_sequence_processor(sz, from_parent, to_parent_); make_sequence_processor(sz, from_parent, to_parent_);
}; };
move to_child move to_child
}); });
// latch stores true after we've started // latch stores true after we've started
// reading the sequence of interest // reading the sequence of interest
let mut proc_mode = false; let mut proc_mode = false;

View file

@ -22,7 +22,7 @@
extern mod std; extern mod std;
use io::WriterUtil; use io::WriterUtil;
use std::map::HashMap; use std::oldmap::HashMap;
struct cmplx { struct cmplx {
re: f64, re: f64,
@ -134,11 +134,11 @@ fn writer(path: ~str, pport: pipes::Port<Line>, size: uint)
done += 1_u; done += 1_u;
let mut prev = done; let mut prev = done;
while prev <= i { while prev <= i {
if lines.contains_key(prev) { if lines.contains_key_ref(&prev) {
debug!("WS %u", prev); debug!("WS %u", prev);
cout.write(lines.get(prev)); cout.write(lines.get(prev));
done += 1_u; done += 1_u;
lines.remove(prev); lines.remove(&prev);
prev += 1_u; prev += 1_u;
} }
else { else {

View file

@ -10,8 +10,8 @@
//buggy.rs //buggy.rs
extern mod std; extern mod std;
use std::map::HashMap; use std::oldmap::HashMap;
use std::map; use std::oldmap;
fn main() { fn main() {
let buggy_map :HashMap<uint, &uint> = let buggy_map :HashMap<uint, &uint> =

View file

@ -10,7 +10,7 @@
// error-pattern: mismatched types // error-pattern: mismatched types
extern mod std; extern mod std;
use std::map::HashMap; use std::oldmap::HashMap;
use std::bitv; use std::bitv;
type fn_info = {vars: HashMap<uint, var_info>}; type fn_info = {vars: HashMap<uint, var_info>};

View file

@ -8,16 +8,14 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
extern mod std; use core::container::Map;
use std::map; use core::hashmap::linear::LinearMap;
use std::map::HashMap;
use std::map::StdMap;
// Test that trait types printed in error msgs include the type arguments. // Test that trait types printed in error msgs include the type arguments.
fn main() { fn main() {
let x: StdMap<~str,~str> = map::HashMap::<~str,~str>() as let x: Map<~str, ~str> = LinearMap::new::<~str, ~str>() as
StdMap::<~str,~str>; Map::<~str, ~str>;
let y: StdMap<uint,~str> = x; let y: Map<uint, ~str> = x;
//~^ ERROR mismatched types: expected `@std::map::StdMap<uint,~str>` //~^ ERROR mismatched types: expected `@core::container::Map/&<uint,~str>`
} }

View file

@ -11,12 +11,12 @@
// error-pattern:fail // error-pattern:fail
extern mod std; extern mod std;
use std::map; use std::oldmap;
use std::map::HashMap; use std::oldmap::HashMap;
fn main() { fn main() {
let count = @mut 0u; let count = @mut 0u;
let map = map::HashMap(); let map = oldmap::HashMap();
let mut arr = ~[]; let mut arr = ~[];
for uint::range(0u, 10u) |i| { for uint::range(0u, 10u) |i| {
arr += ~[@~"key stuff"]; arr += ~[@~"key stuff"];

View file

@ -12,7 +12,7 @@
// xfail-fast // xfail-fast
extern mod std; extern mod std;
use std::map::*; use std::oldmap::*;
class cat : map<int, bool> { class cat : map<int, bool> {
priv { priv {

View file

@ -9,10 +9,8 @@
// except according to those terms. // except according to those terms.
// xfail-fast // xfail-fast
#[legacy_modes];
extern mod std; use core::container::{Container, Mutable, Map};
use std::map::*;
enum cat_type { tuxedo, tabby, tortoiseshell } enum cat_type { tuxedo, tabby, tortoiseshell }
@ -28,121 +26,110 @@ impl cat_type : cmp::Eq {
// ok: T should be in scope when resolving the trait ref for map // ok: T should be in scope when resolving the trait ref for map
struct cat<T> { struct cat<T> {
// Yes, you can have negative meows // Yes, you can have negative meows
priv mut meows : int, priv mut meows : int,
mut how_hungry : int, mut how_hungry : int,
name : T, name : T,
} }
impl<T: Copy> cat<T> { impl<T> cat<T> {
fn speak() { self.meow(); } fn speak(&mut self) { self.meow(); }
fn eat() -> bool { fn eat(&mut self) -> bool {
if self.how_hungry > 0 { if self.how_hungry > 0 {
error!("OM NOM NOM"); error!("OM NOM NOM");
self.how_hungry -= 2; self.how_hungry -= 2;
return true; return true;
} } else {
else { error!("Not hungry!");
error!("Not hungry!"); return false;
return false; }
}
}
}
impl<T: Copy> cat<T> : StdMap<int, T> {
pure fn size() -> uint { self.meows as uint }
fn insert(+k: int, +_v: T) -> bool {
self.meows += k;
true
}
pure fn contains_key(+k: int) -> bool { k <= self.meows }
pure fn contains_key_ref(k: &int) -> bool { self.contains_key(*k) }
pure fn get(+k:int) -> T { match self.find(k) {
Some(v) => { v }
None => { die!(~"epic fail"); }
}
}
pure fn find(+k:int) -> Option<T> { if k <= self.meows {
Some(self.name)
}
else { None }
}
fn update_with_key(+key: int, +val: T, ff: fn(+k: int, +v0: T, +v1: T) -> T) -> bool {
match self.find(key) {
None => return self.insert(key, val),
Some(copy orig) => return self.insert(key, ff(key, orig, val))
}
}
fn update(+key: int, +val: T, ff: fn(+v0: T, +v1: T) -> T) -> bool {
match self.find(key) {
None => return self.insert(key, val),
Some(copy orig) => return self.insert(key, ff(orig, val))
}
}
fn remove(+k:int) -> bool {
match self.find(k) {
Some(x) => {
self.meows -= k; true
}
None => { false }
}
}
pure fn each(f: fn(+v: int, +v: T) -> bool) {
let mut n = int::abs(self.meows);
while n > 0 {
if !f(n, self.name) { break; }
n -= 1;
}
}
pure fn each_key(&&f: fn(+v: int) -> bool) {
for self.each |k, _v| { if !f(k) { break; } loop;};
}
pure fn each_value(&&f: fn(+v: T) -> bool) {
for self.each |_k, v| { if !f(v) { break; } loop;};
}
pure fn each_ref(f: fn(k: &int, v: &T) -> bool) {}
pure fn each_key_ref(f: fn(k: &int) -> bool) {}
pure fn each_value_ref(f: fn(k: &T) -> bool) {}
fn clear() { }
}
priv impl<T: Copy> cat<T> {
fn meow() {
self.meows += 1;
error!("Meow %d", self.meows);
if self.meows % 5 == 0 {
self.how_hungry += 1;
}
} }
} }
fn cat<T: Copy>(in_x : int, in_y : int, in_name: T) -> cat<T> { impl<T> cat<T>: Container {
cat { pure fn len(&self) -> uint { self.meows as uint }
meows: in_x, pure fn is_empty(&self) -> bool { self.meows == 0 }
how_hungry: in_y, }
name: in_name
impl<T> cat<T>: Mutable {
fn clear(&mut self) {}
}
impl<T> cat<T>: Map<int, T> {
pure fn contains_key(&self, k: &int) -> bool { *k <= self.meows }
pure fn each(&self, f: fn(v: &int, v: &T) -> bool) {
let mut n = int::abs(self.meows);
while n > 0 {
if !f(&n, &self.name) { break; }
n -= 1;
}
}
pure fn each_key(&self, f: fn(v: &int) -> bool) {
for self.each |k, _| { if !f(k) { break; } loop;};
}
pure fn each_value(&self, f: fn(v: &T) -> bool) {
for self.each |_, v| { if !f(v) { break; } loop;};
}
fn insert(&mut self, k: int, _: T) -> bool {
self.meows += k;
true
}
pure fn find(&self, k: &int) -> Option<&self/T> {
if *k <= self.meows {
Some(&self.name)
} else {
None
}
}
fn remove(&mut self, k: &int) -> bool {
match self.find(k) {
Some(_) => {
self.meows -= *k; true
}
None => { false }
}
} }
} }
pub fn main() { impl<T> cat<T> {
let nyan : cat<~str> = cat(0, 2, ~"nyan"); pure fn get(&self, k: &int) -> &self/T {
for uint::range(1u, 5u) |_i| { nyan.speak(); } match self.find(k) {
assert(nyan.find(1) == Some(~"nyan")); Some(v) => { v }
assert(nyan.find(10) == None); None => { die!(~"epic fail"); }
let spotty : cat<cat_type> = cat(2, 57, tuxedo); }
for uint::range(0u, 6u) |_i| { spotty.speak(); } }
assert(spotty.size() == 8u);
assert(spotty.contains_key(2)); static pure fn new(in_x: int, in_y: int, in_name: T) -> cat<T> {
assert(spotty.get(3) == tuxedo); cat{meows: in_x, how_hungry: in_y, name: in_name }
}
}
priv impl<T> cat<T> {
fn meow(&mut self) {
self.meows += 1;
error!("Meow %d", self.meows);
if self.meows % 5 == 0 {
self.how_hungry += 1;
}
}
}
fn main() {
let mut nyan: cat<~str> = cat::new(0, 2, ~"nyan");
for uint::range(1, 5) |_| { nyan.speak(); }
assert(*nyan.find(&1).unwrap() == ~"nyan");
assert(nyan.find(&10) == None);
let mut spotty: cat<cat_type> = cat::new(2, 57, tuxedo);
for uint::range(0, 6) |_| { spotty.speak(); }
assert(spotty.len() == 8);
assert(spotty.contains_key(&2));
assert(spotty.get(&3) == &tuxedo);
} }

View file

@ -11,7 +11,7 @@
// xfail-test // xfail-test
extern mod std; extern mod std;
use std::map::*; use std::oldmap::*;
use vec::*; use vec::*;
use dvec::{dvec, extensions}; use dvec::{dvec, extensions};

Some files were not shown because too many files have changed in this diff Show more