about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-03-07 16:48:57 -0800
committerPatrick Walton <pcwalton@mimiga.net>2012-03-07 17:35:13 -0800
commitc9375fed8d55197a528edb3c3182aaf3b71abe76 (patch)
tree2d1ed1a7f5954b14e4f92f8745908ad6f92355b8 /src
parentc245d9e980946d4472e9c830a109db77e1bcb038 (diff)
downloadrust-c9375fed8d55197a528edb3c3182aaf3b71abe76.tar.gz
rust-c9375fed8d55197a528edb3c3182aaf3b71abe76.zip
stdlib: Stop incurring vtable dispatch costs when hashmaps are used
This required changing almost all users of hashmaps to import the hashmap interface first.

The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
Diffstat (limited to 'src')
-rw-r--r--src/cargo/cargo.rs1
-rw-r--r--src/libstd/json.rs3
-rw-r--r--src/libstd/map.rs54
-rw-r--r--src/libstd/uv.rs13
-rw-r--r--src/rustc/back/link.rs1
-rw-r--r--src/rustc/back/rpath.rs1
-rw-r--r--src/rustc/front/attr.rs1
-rw-r--r--src/rustc/lib/llvm.rs1
-rw-r--r--src/rustc/metadata/astencode.rs6
-rw-r--r--src/rustc/metadata/csearch.rs1
-rw-r--r--src/rustc/metadata/cstore.rs1
-rw-r--r--src/rustc/metadata/decoder.rs1
-rw-r--r--src/rustc/metadata/encoder.rs1
-rw-r--r--src/rustc/metadata/reachable.rs3
-rw-r--r--src/rustc/metadata/tydecode.rs1
-rw-r--r--src/rustc/middle/alias.rs1
-rw-r--r--src/rustc/middle/ast_map.rs3
-rw-r--r--src/rustc/middle/capture.rs1
-rw-r--r--src/rustc/middle/check_alt.rs1
-rw-r--r--src/rustc/middle/check_const.rs1
-rw-r--r--src/rustc/middle/fn_usage.rs1
-rw-r--r--src/rustc/middle/kind.rs1
-rw-r--r--src/rustc/middle/last_use.rs1
-rw-r--r--src/rustc/middle/lint.rs1
-rw-r--r--src/rustc/middle/mutbl.rs1
-rw-r--r--src/rustc/middle/pat_util.rs1
-rw-r--r--src/rustc/middle/trans/alt.rs1
-rw-r--r--src/rustc/middle/trans/closure.rs1
-rw-r--r--src/rustc/middle/trans/impl.rs1
-rw-r--r--src/rustc/middle/trans/native.rs3
-rw-r--r--src/rustc/middle/trans/type_of.rs1
-rw-r--r--src/rustc/middle/tstate/auxiliary.rs2
-rw-r--r--src/rustc/middle/tstate/bitvectors.rs1
-rw-r--r--src/rustc/middle/tstate/ck.rs1
-rw-r--r--src/rustc/middle/tstate/collect_locals.rs1
-rw-r--r--src/rustc/middle/tstate/pre_post_conditions.rs1
-rw-r--r--src/rustc/middle/tstate/states.rs1
-rw-r--r--src/rustdoc/astsrv.rs1
-rw-r--r--src/rustdoc/attr_pass.rs3
-rw-r--r--src/rustdoc/prune_hidden_pass.rs1
-rw-r--r--src/rustdoc/prune_unexported_pass.rs3
-rw-r--r--src/rustdoc/reexport_pass.rs1
-rw-r--r--src/rustdoc/tystr_pass.rs1
-rw-r--r--src/serializer/serializer.rs4
-rw-r--r--src/test/bench/shootout-mandelbrot.rs1
-rw-r--r--src/test/bench/task-perf-word-count.rs1
-rw-r--r--src/test/compile-fail/map-types.rs6
-rw-r--r--src/test/run-fail/unwind-misc-1.rs3
-rw-r--r--src/test/run-pass/hashmap-memory.rs1
-rw-r--r--src/test/run-pass/issue-1696.rs1
50 files changed, 96 insertions, 47 deletions
diff --git a/src/cargo/cargo.rs b/src/cargo/cargo.rs
index a4816fedf97..c188b9d9443 100644
--- a/src/cargo/cargo.rs
+++ b/src/cargo/cargo.rs
@@ -16,6 +16,7 @@ import io::writer_util;
 import std::json;
 import result;
 import std::map;
+import std::map::hashmap;
 import std::os;
 import std::run;
 import str;
diff --git a/src/libstd/json.rs b/src/libstd/json.rs
index 51069cf9729..26e4cc3165e 100644
--- a/src/libstd/json.rs
+++ b/src/libstd/json.rs
@@ -5,6 +5,7 @@ import result::{ok, err};
 import io;
 import io::{reader_util, writer_util};
 import map;
+import map::hashmap;
 
 export json;
 export error;
@@ -36,7 +37,7 @@ enum json {
     /* Variant: list */
     list([json]),
     /* Variant: dict */
-    dict(map::map<str,json>),
+    dict(map::hashmap<str,json>),
     /* Variant: null */
     null,
 }
diff --git a/src/libstd/map.rs b/src/libstd/map.rs
index c2320e93f29..0511b82b5ba 100644
--- a/src/libstd/map.rs
+++ b/src/libstd/map.rs
@@ -4,6 +4,10 @@ Module: map
 A map type
 */
 
+import chained::hashmap;
+export hashmap, hashfn, eqfn, set, map, chained, mk_hashmap, new_str_hash;
+export new_bytes_hash, new_int_hash, new_uint_hash, set_add;
+
 /* Section: Types */
 
 /*
@@ -23,14 +27,13 @@ Equality
 type eqfn<K> = fn@(K, K) -> bool;
 
 /*
-Type: hashset
+Type: set
 
-A convenience type to treat a map as a set
+A convenience type to treat a hashmap as a set
 */
-type set<K> = map<K, ()>;
+type set<K> = hashmap<K, ()>;
 
-// Temporary alias to make migration easier
-type hashmap<K, V> = map<K, V>;
+type hashmap<K, V> = chained::t<K, V>;
 
 /*
 IFace: map
@@ -103,8 +106,7 @@ iface map<K: copy, V: copy> {
 }
 
 // FIXME: package this up and export it as a datatype usable for
-// external code that doesn't want to pay the cost of a box and vtable
-// lookups.
+// external code that doesn't want to pay the cost of a box.
 mod chained {
     type entry<K, V> = {
         hash: uint,
@@ -118,8 +120,8 @@ mod chained {
         absent
     }
 
-    type t<K, V> = {
-        mutable size: uint,
+    type t<K, V> = @{
+        mutable count: uint,
         mutable chains: [mutable chain<K,V>],
         hasher: hashfn<K>,
         eqer: eqfn<K>
@@ -185,7 +187,7 @@ mod chained {
         let hash = tbl.hasher(k);
         alt search_tbl(tbl, k, hash) {
           not_found {
-            tbl.size += 1u;
+            tbl.count += 1u;
             let idx = hash % vec::len(tbl.chains);
             let old_chain = tbl.chains[idx];
             tbl.chains[idx] = present(@{
@@ -229,13 +231,13 @@ mod chained {
           }
 
           found_first(idx, entry) {
-            tbl.size -= 1u;
+            tbl.count -= 1u;
             tbl.chains[idx] = entry.next;
             ret core::option::some(entry.value);
           }
 
           found_after(eprev, entry) {
-            tbl.size -= 1u;
+            tbl.count -= 1u;
             eprev.next = entry.next;
             ret core::option::some(entry.value);
           }
@@ -291,12 +293,12 @@ mod chained {
         }
     }
 
-    impl <K: copy, V: copy> of map<K, V> for t<K, V> {
-        fn size() -> uint { self.size }
+    impl hashmap<K: copy, V: copy> of map<K, V> for t<K, V> {
+        fn size() -> uint { self.count }
 
         fn insert(k: K, v: V) -> bool {
             let nchains = vec::len(self.chains);
-            let load = {num: (self.size + 1u) as int, den: nchains as int};
+            let load = {num: (self.count + 1u) as int, den: nchains as int};
             // Structural consts would be nice. This is a const 3/4
             // load factor that we compare against.
             if !util::rational_leq(load, {num:3, den:4}) { rehash(self); }
@@ -318,13 +320,13 @@ mod chained {
         fn values(blk: fn(V)) { items(self) { |_k, v| blk(v) } }
     }
 
-    fn mk<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>) -> map<K,V> {
+    fn mk<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>) -> t<K,V> {
         let initial_capacity: uint = 32u; // 2^5
-        let slf: t<K, V> = {mutable size: 0u,
-                            mutable chains: chains(initial_capacity),
-                            hasher: hasher,
-                            eqer: eqer};
-        slf as map::<K, V>
+        let slf: t<K, V> = @{mutable count: 0u,
+                             mutable chains: chains(initial_capacity),
+                             hasher: hasher,
+                             eqer: eqer};
+        slf
     }
 }
 
@@ -339,7 +341,7 @@ hasher - The hash function for key type K
 eqer - The equality function for key type K
 */
 fn mk_hashmap<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>)
-    -> map<K, V> {
+        -> hashmap<K, V> {
     chained::mk(hasher, eqer)
 }
 
@@ -348,7 +350,7 @@ Function: new_str_hash
 
 Construct a hashmap for string keys
 */
-fn new_str_hash<V: copy>() -> map<str, V> {
+fn new_str_hash<V: copy>() -> hashmap<str, V> {
     ret mk_hashmap(str::hash, str::eq);
 }
 
@@ -357,7 +359,7 @@ Function: new_bytes_hash
 
 Construct a hashmap for byte string keys
 */
-fn new_bytes_hash<V: copy>() -> map<[u8], V> {
+fn new_bytes_hash<V: copy>() -> hashmap<[u8], V> {
     ret mk_hashmap(vec::u8::hash, vec::u8::eq);
 }
 
@@ -366,7 +368,7 @@ Function: new_int_hash
 
 Construct a hashmap for int keys
 */
-fn new_int_hash<V: copy>() -> map<int, V> {
+fn new_int_hash<V: copy>() -> hashmap<int, V> {
     fn hash_int(&&x: int) -> uint { int::hash(x) }
     fn eq_int(&&a: int, &&b: int) -> bool { ret a == b; }
     ret mk_hashmap(hash_int, eq_int);
@@ -377,7 +379,7 @@ Function: new_uint_hash
 
 Construct a hashmap for uint keys
 */
-fn new_uint_hash<V: copy>() -> map<uint, V> {
+fn new_uint_hash<V: copy>() -> hashmap<uint, V> {
     fn hash_uint(&&x: uint) -> uint { uint::hash(x) }
     fn eq_uint(&&a: uint, &&b: uint) -> bool { ret a == b; }
     ret mk_hashmap(hash_uint, eq_uint);
diff --git a/src/libstd/uv.rs b/src/libstd/uv.rs
index 875656d3a22..9991d68b295 100644
--- a/src/libstd/uv.rs
+++ b/src/libstd/uv.rs
@@ -1,3 +1,4 @@
+import map::hashmap;
 export loop_new, loop_delete, run, close, run_in_bg;
 export async_init, async_send;
 export timer_init, timer_start, timer_stop;
@@ -129,17 +130,17 @@ fn loop_new() -> uv_loop unsafe {
             process_operation);
 
         // all state goes here
-        let handles: map::map<[u8], *ctypes::void> =
+        let handles: map::hashmap<[u8], *ctypes::void> =
             map::new_bytes_hash();
-        let id_to_handle: map::map<[u8], uv_handle> =
+        let id_to_handle: map::hashmap<[u8], uv_handle> =
             map::new_bytes_hash();
-        let after_cbs: map::map<[u8], fn~(uv_handle)> =
+        let after_cbs: map::hashmap<[u8], fn~(uv_handle)> =
             map::new_bytes_hash();
-        let close_callbacks: map::map<[u8], fn~()> =
+        let close_callbacks: map::hashmap<[u8], fn~()> =
             map::new_bytes_hash();
-        let async_cbs: map::map<[u8], fn~(uv_handle)> =
+        let async_cbs: map::hashmap<[u8], fn~(uv_handle)> =
             map::new_bytes_hash();
-        let timer_cbs: map::map<[u8], fn~(uv_handle)> =
+        let timer_cbs: map::hashmap<[u8], fn~(uv_handle)> =
             map::new_bytes_hash();
 
         // the main loop that this task blocks on.
diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs
index 63062986363..1889497957c 100644
--- a/src/rustc/back/link.rs
+++ b/src/rustc/back/link.rs
@@ -7,6 +7,7 @@ import middle::ty;
 import metadata::{encoder, cstore};
 import middle::trans::common::crate_ctxt;
 import std::fs;
+import std::map::hashmap;
 import std::run;
 import std::sha1::sha1;
 import syntax::ast;
diff --git a/src/rustc/back/rpath.rs b/src/rustc/back/rpath.rs
index cc74efa82cf..8ecb48f86ea 100644
--- a/src/rustc/back/rpath.rs
+++ b/src/rustc/back/rpath.rs
@@ -1,4 +1,5 @@
 import std::{os, fs, os_fs, map};
+import std::map::hashmap;
 import metadata::cstore;
 import driver::session;
 import util::filesearch;
diff --git a/src/rustc/front/attr.rs b/src/rustc/front/attr.rs
index 4f4fecbe409..834d0957ca5 100644
--- a/src/rustc/front/attr.rs
+++ b/src/rustc/front/attr.rs
@@ -1,6 +1,7 @@
 // Functions dealing with attributes and meta_items
 
 import std::map;
+import std::map::hashmap;
 import syntax::{ast, ast_util};
 import driver::session::session;
 
diff --git a/src/rustc/lib/llvm.rs b/src/rustc/lib/llvm.rs
index 2dc2945d8de..83b45583a61 100644
--- a/src/rustc/lib/llvm.rs
+++ b/src/rustc/lib/llvm.rs
@@ -1,4 +1,5 @@
 import str::sbuf;
+import std::map::hashmap;
 
 import ctypes::{c_int, c_uint, unsigned, longlong, ulonglong};
 
diff --git a/src/rustc/metadata/astencode.rs b/src/rustc/metadata/astencode.rs
index 87e2138a247..d3d8593b654 100644
--- a/src/rustc/metadata/astencode.rs
+++ b/src/rustc/metadata/astencode.rs
@@ -4,15 +4,15 @@ import syntax::visit;
 import syntax::ast_util;
 import syntax::ast_util::inlined_item_methods;
 import syntax::codemap::span;
-import std::map::map;
-import std::smallintmap::map;
 import std::ebml;
 import std::ebml::writer;
+import std::map::hashmap;
 import std::serialization;
 import std::serialization::serializer;
 import std::serialization::deserializer;
 import std::serialization::serializer_helpers;
 import std::serialization::deserializer_helpers;
+import std::smallintmap::map;
 import middle::trans::common::maps;
 import middle::{ty, typeck, last_use, ast_map};
 import middle::typeck::method_origin;
@@ -922,4 +922,4 @@ fn test_more() {
             ret z;
         }
     });
-}
\ No newline at end of file
+}
diff --git a/src/rustc/metadata/csearch.rs b/src/rustc/metadata/csearch.rs
index dc41753d782..0da50704635 100644
--- a/src/rustc/metadata/csearch.rs
+++ b/src/rustc/metadata/csearch.rs
@@ -6,6 +6,7 @@ import middle::{ty, ast_map};
 import option::{some, none};
 import driver::session;
 import middle::trans::common::maps;
+import std::map::hashmap;
 
 export get_symbol;
 export get_type_param_count;
diff --git a/src/rustc/metadata/cstore.rs b/src/rustc/metadata/cstore.rs
index e9dd1a010c5..24670e1394e 100644
--- a/src/rustc/metadata/cstore.rs
+++ b/src/rustc/metadata/cstore.rs
@@ -2,6 +2,7 @@
 // crates and libraries
 
 import std::map;
+import std::map::hashmap;
 import syntax::ast;
 import util::common::*;
 
diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs
index 196789ee58c..c43ed20b2fc 100644
--- a/src/rustc/metadata/decoder.rs
+++ b/src/rustc/metadata/decoder.rs
@@ -1,6 +1,7 @@
 // Decoding metadata from a single crate's metadata
 
 import std::{ebml, map, io};
+import std::map::hashmap;
 import io::writer_util;
 import syntax::{ast, ast_util};
 import driver::session::session;
diff --git a/src/rustc/metadata/encoder.rs b/src/rustc/metadata/encoder.rs
index ab6a8dea04c..c2c0cbc9150 100644
--- a/src/rustc/metadata/encoder.rs
+++ b/src/rustc/metadata/encoder.rs
@@ -1,6 +1,7 @@
 // Metadata encoding
 
 import std::{io, ebml, map, list};
+import std::map::hashmap;
 import io::writer_util;
 import ebml::writer;
 import syntax::ast::*;
diff --git a/src/rustc/metadata/reachable.rs b/src/rustc/metadata/reachable.rs
index e85d4098fde..dad1f9b7039 100644
--- a/src/rustc/metadata/reachable.rs
+++ b/src/rustc/metadata/reachable.rs
@@ -10,10 +10,11 @@ import syntax::ast::*;
 import syntax::visit;
 import syntax::ast_util::def_id_of_def;
 import front::attr;
+import std::map::hashmap;
 
 export map, find_reachable;
 
-type map = std::map::map<node_id, ()>;
+type map = std::map::hashmap<node_id, ()>;
 
 type ctx = {ccx: middle::trans::common::crate_ctxt,
             rmap: map};
diff --git a/src/rustc/metadata/tydecode.rs b/src/rustc/metadata/tydecode.rs
index 5d97777c0fb..284c38a6a3e 100644
--- a/src/rustc/metadata/tydecode.rs
+++ b/src/rustc/metadata/tydecode.rs
@@ -5,6 +5,7 @@ import syntax::ast::*;
 import syntax::ast_util;
 import syntax::ast_util::respan;
 import middle::ty;
+import std::map::hashmap;
 
 export parse_ty_data, parse_def_id;
 export parse_bounds_data;
diff --git a/src/rustc/middle/alias.rs b/src/rustc/middle/alias.rs
index cb0785b4df1..cc5a68e7b11 100644
--- a/src/rustc/middle/alias.rs
+++ b/src/rustc/middle/alias.rs
@@ -5,6 +5,7 @@ import syntax::codemap::span;
 import syntax::visit;
 import visit::vt;
 import std::list;
+import std::map::hashmap;
 import std::util::unreachable;
 import option::is_none;
 import list::list;
diff --git a/src/rustc/middle/ast_map.rs b/src/rustc/middle/ast_map.rs
index 3ff8a96f287..c39686b0d30 100644
--- a/src/rustc/middle/ast_map.rs
+++ b/src/rustc/middle/ast_map.rs
@@ -1,4 +1,5 @@
 import std::map;
+import std::map::hashmap;
 import syntax::ast::*;
 import syntax::ast_util;
 import syntax::ast_util::inlined_item_methods;
@@ -35,7 +36,7 @@ enum ast_node {
     node_res_ctor(@item),
 }
 
-type map = std::map::map<node_id, ast_node>;
+type map = std::map::hashmap<node_id, ast_node>;
 type ctx = {map: map, mutable path: path, mutable local_id: uint};
 type vt = visit::vt<ctx>;
 
diff --git a/src/rustc/middle/capture.rs b/src/rustc/middle/capture.rs
index 3ec56c62077..7da4edfc956 100644
--- a/src/rustc/middle/capture.rs
+++ b/src/rustc/middle/capture.rs
@@ -1,6 +1,7 @@
 import syntax::{ast, ast_util};
 import driver::session::session;
 import std::map;
+import std::map::hashmap;
 
 export capture_mode;
 export capture_var;
diff --git a/src/rustc/middle/check_alt.rs b/src/rustc/middle/check_alt.rs
index 6d55aed095e..a52669b65d7 100644
--- a/src/rustc/middle/check_alt.rs
+++ b/src/rustc/middle/check_alt.rs
@@ -8,6 +8,7 @@ import syntax::visit;
 import driver::session::session;
 import middle::ty;
 import middle::ty::*;
+import std::map::hashmap;
 
 fn check_crate(tcx: ty::ctxt, crate: @crate) {
     visit::visit_crate(*crate, (), visit::mk_vt(@{
diff --git a/src/rustc/middle/check_const.rs b/src/rustc/middle/check_const.rs
index d04abffb320..c36aeaede76 100644
--- a/src/rustc/middle/check_const.rs
+++ b/src/rustc/middle/check_const.rs
@@ -1,6 +1,7 @@
 import syntax::ast::*;
 import syntax::{visit, ast_util};
 import driver::session::session;
+import std::map::hashmap;
 
 fn check_crate(sess: session, crate: @crate, method_map: typeck::method_map) {
     visit::visit_crate(*crate, false, visit::mk_vt(@{
diff --git a/src/rustc/middle/fn_usage.rs b/src/rustc/middle/fn_usage.rs
index c415f5deb05..332b316b986 100644
--- a/src/rustc/middle/fn_usage.rs
+++ b/src/rustc/middle/fn_usage.rs
@@ -1,3 +1,4 @@
+import std::map::hashmap;
 import syntax::ast;
 import syntax::visit;
 import syntax::print::pprust::expr_to_str;
diff --git a/src/rustc/middle/kind.rs b/src/rustc/middle/kind.rs
index e7999f04cad..9672848f4c8 100644
--- a/src/rustc/middle/kind.rs
+++ b/src/rustc/middle/kind.rs
@@ -3,6 +3,7 @@ import syntax::ast::*;
 import syntax::codemap::span;
 import ty::{kind, kind_copyable, kind_sendable, kind_noncopyable};
 import driver::session::session;
+import std::map::hashmap;
 
 // Kind analysis pass. There are three kinds:
 //
diff --git a/src/rustc/middle/last_use.rs b/src/rustc/middle/last_use.rs
index 12ffdfccb41..60954e25c91 100644
--- a/src/rustc/middle/last_use.rs
+++ b/src/rustc/middle/last_use.rs
@@ -4,6 +4,7 @@ import syntax::codemap::span;
 import std::list::{is_not_empty, list, nil, cons, tail};
 import std::util::unreachable;
 import std::list;
+import std::map::hashmap;
 
 // Last use analysis pass.
 //
diff --git a/src/rustc/middle/lint.rs b/src/rustc/middle/lint.rs
index f46a50ea4a1..65b570e35a2 100644
--- a/src/rustc/middle/lint.rs
+++ b/src/rustc/middle/lint.rs
@@ -3,6 +3,7 @@ import middle::ty::ctxt;
 import syntax::{ast, visit};
 import front::attr;
 import std::io;
+import std::map::hashmap;
 import io::writer_util;
 
 enum option {
diff --git a/src/rustc/middle/mutbl.rs b/src/rustc/middle/mutbl.rs
index bf51f7d3764..dacf6e5ca98 100644
--- a/src/rustc/middle/mutbl.rs
+++ b/src/rustc/middle/mutbl.rs
@@ -2,6 +2,7 @@ import syntax::ast::*;
 import syntax::visit;
 import syntax::ast_util;
 import driver::session::session;
+import std::map::hashmap;
 
 enum deref_t { unbox(bool), field, index, }
 
diff --git a/src/rustc/middle/pat_util.rs b/src/rustc/middle/pat_util.rs
index 1a6856e36bf..08aa720be68 100644
--- a/src/rustc/middle/pat_util.rs
+++ b/src/rustc/middle/pat_util.rs
@@ -4,6 +4,7 @@ import syntax::ast_util::respan;
 import syntax::fold;
 import syntax::fold::*;
 import syntax::codemap::span;
+import std::map::hashmap;
 
 export walk_pat;
 export pat_binding_ids, pat_bindings, pat_id_map;
diff --git a/src/rustc/middle/trans/alt.rs b/src/rustc/middle/trans/alt.rs
index 6ada125be07..169b74b7a25 100644
--- a/src/rustc/middle/trans/alt.rs
+++ b/src/rustc/middle/trans/alt.rs
@@ -12,6 +12,7 @@ import syntax::codemap::span;
 import syntax::print::pprust::pat_to_str;
 import back::abi;
 import resolve::def_map;
+import std::map::hashmap;
 
 import common::*;
 
diff --git a/src/rustc/middle/trans/closure.rs b/src/rustc/middle/trans/closure.rs
index f11dbae04b8..ceadecb5c83 100644
--- a/src/rustc/middle/trans/closure.rs
+++ b/src/rustc/middle/trans/closure.rs
@@ -18,6 +18,7 @@ import util::ppaux::ty_to_str;
 import shape::{size_of};
 import ast_map::{path, path_mod, path_name};
 import driver::session::session;
+import std::map::hashmap;
 
 // ___Good to know (tm)__________________________________________________
 //
diff --git a/src/rustc/middle/trans/impl.rs b/src/rustc/middle/trans/impl.rs
index e4e1859e87d..86522ba9934 100644
--- a/src/rustc/middle/trans/impl.rs
+++ b/src/rustc/middle/trans/impl.rs
@@ -11,6 +11,7 @@ import lib::llvm::llvm;
 import lib::llvm::{ValueRef, TypeRef};
 import lib::llvm::llvm::LLVMGetParam;
 import ast_map::{path, path_mod, path_name};
+import std::map::hashmap;
 
 // Translation functionality related to impls and ifaces
 //
diff --git a/src/rustc/middle/trans/native.rs b/src/rustc/middle/trans/native.rs
index 26621158f77..dff2a207cd0 100644
--- a/src/rustc/middle/trans/native.rs
+++ b/src/rustc/middle/trans/native.rs
@@ -9,6 +9,7 @@ import common::*;
 import build::*;
 import base::*;
 import type_of::*;
+import std::map::hashmap;
 
 export link_name, trans_native_mod, register_crust_fn, trans_crust_fn;
 
@@ -358,4 +359,4 @@ fn register_crust_fn(ccx: crate_ctxt, sp: span,
     let llfty = T_fn(llargtys, llretty);
     register_fn_fuller(ccx, sp, path, "crust fn", node_id,
                        t, lib::llvm::CCallConv, llfty)
-}
\ No newline at end of file
+}
diff --git a/src/rustc/middle/trans/type_of.rs b/src/rustc/middle/trans/type_of.rs
index e613fdf3cd9..89de5e249a2 100644
--- a/src/rustc/middle/trans/type_of.rs
+++ b/src/rustc/middle/trans/type_of.rs
@@ -3,6 +3,7 @@ import lib::llvm::{TypeRef};
 import syntax::ast;
 import lib::llvm::llvm;
 import driver::session::session;
+import std::map::hashmap;
 
 import ty::*;
 
diff --git a/src/rustc/middle/tstate/auxiliary.rs b/src/rustc/middle/tstate/auxiliary.rs
index 89fce0ddb70..e49748f6b65 100644
--- a/src/rustc/middle/tstate/auxiliary.rs
+++ b/src/rustc/middle/tstate/auxiliary.rs
@@ -4,7 +4,7 @@ import syntax::ast::*;
 import syntax::ast_util::*;
 import syntax::{visit, codemap};
 import codemap::span;
-import std::map::{new_int_hash};
+import std::map::{hashmap, new_int_hash};
 import syntax::print::pprust::path_to_str;
 import tstate::ann::{pre_and_post, pre_and_post_state, empty_ann, prestate,
                      poststate, precond, postcond,
diff --git a/src/rustc/middle/tstate/bitvectors.rs b/src/rustc/middle/tstate/bitvectors.rs
index 6acb23d906a..7433da333ac 100644
--- a/src/rustc/middle/tstate/bitvectors.rs
+++ b/src/rustc/middle/tstate/bitvectors.rs
@@ -12,6 +12,7 @@ import tstate::ann::{pre_and_post, precond, postcond, prestate, poststate,
 import tritv::*;
 import util::common::*;
 import driver::session::session;
+import std::map::hashmap;
 
 fn bit_num(fcx: fn_ctxt, c: tsconstr) -> uint {
     let d = tsconstr_to_def_id(c);
diff --git a/src/rustc/middle/tstate/ck.rs b/src/rustc/middle/tstate/ck.rs
index 357d43edc8e..56001460f8b 100644
--- a/src/rustc/middle/tstate/ck.rs
+++ b/src/rustc/middle/tstate/ck.rs
@@ -14,6 +14,7 @@ import collect_locals::mk_f_to_fn_info;
 import pre_post_conditions::fn_pre_post;
 import states::find_pre_post_state_fn;
 import driver::session::session;
+import std::map::hashmap;
 
 fn check_unused_vars(fcx: fn_ctxt) {
 
diff --git a/src/rustc/middle/tstate/collect_locals.rs b/src/rustc/middle/tstate/collect_locals.rs
index 9b39814e141..79a085b892e 100644
--- a/src/rustc/middle/tstate/collect_locals.rs
+++ b/src/rustc/middle/tstate/collect_locals.rs
@@ -8,6 +8,7 @@ import syntax::codemap::span;
 import syntax::ast_util::respan;
 import driver::session::session;
 import aux::*;
+import std::map::hashmap;
 
 type ctxt = {cs: @mutable [sp_constr], tcx: ty::ctxt};
 
diff --git a/src/rustc/middle/tstate/pre_post_conditions.rs b/src/rustc/middle/tstate/pre_post_conditions.rs
index 6c80234a54b..3fe6f82f42e 100644
--- a/src/rustc/middle/tstate/pre_post_conditions.rs
+++ b/src/rustc/middle/tstate/pre_post_conditions.rs
@@ -13,6 +13,7 @@ import util::common::{new_def_hash, log_expr, field_exprs,
                       has_nonlocal_exits, log_stmt};
 import syntax::codemap::span;
 import driver::session::session;
+import std::map::hashmap;
 
 fn find_pre_post_mod(_m: _mod) -> _mod {
     #debug("implement find_pre_post_mod!");
diff --git a/src/rustc/middle/tstate/states.rs b/src/rustc/middle/tstate/states.rs
index adb86248047..c7eebf317af 100644
--- a/src/rustc/middle/tstate/states.rs
+++ b/src/rustc/middle/tstate/states.rs
@@ -10,6 +10,7 @@ import syntax::codemap::span;
 import middle::ty::{expr_ty, type_is_bot};
 import util::common::*;
 import driver::session::session;
+import std::map::hashmap;
 
 fn forbid_upvar(fcx: fn_ctxt, rhs_id: node_id, sp: span, t: oper_type) {
     alt t {
diff --git a/src/rustdoc/astsrv.rs b/src/rustdoc/astsrv.rs
index 1d689184f59..718e8af35b9 100644
--- a/src/rustdoc/astsrv.rs
+++ b/src/rustdoc/astsrv.rs
@@ -7,6 +7,7 @@
      Rustdoc from its non-sendableness."
 )];
 
+import std::map::hashmap;
 import rustc::driver::session;
 import rustc::driver::driver;
 import rustc::driver::diagnostic;
diff --git a/src/rustdoc/attr_pass.rs b/src/rustdoc/attr_pass.rs
index 237a8d7de77..70572fad825 100644
--- a/src/rustdoc/attr_pass.rs
+++ b/src/rustdoc/attr_pass.rs
@@ -8,6 +8,7 @@
 
 import rustc::syntax::ast;
 import rustc::middle::ast_map;
+import std::map::hashmap;
 
 export mk_pass;
 
@@ -474,4 +475,4 @@ mod test {
             run(srv, doc)
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/rustdoc/prune_hidden_pass.rs b/src/rustdoc/prune_hidden_pass.rs
index 862018a9b80..a368446c68c 100644
--- a/src/rustdoc/prune_hidden_pass.rs
+++ b/src/rustdoc/prune_hidden_pass.rs
@@ -1,5 +1,6 @@
 #[doc = "Prunes things with the #[doc(hidden)] attribute"];
 
+import std::map::hashmap;
 export mk_pass;
 
 fn mk_pass() -> pass {
diff --git a/src/rustdoc/prune_unexported_pass.rs b/src/rustdoc/prune_unexported_pass.rs
index fcd24bebbb4..80fe5732d9d 100644
--- a/src/rustdoc/prune_unexported_pass.rs
+++ b/src/rustdoc/prune_unexported_pass.rs
@@ -3,6 +3,7 @@
 import rustc::syntax::ast;
 import rustc::syntax::ast_util;
 import rustc::middle::ast_map;
+import std::map::hashmap;
 
 export mk_pass;
 
@@ -253,4 +254,4 @@ mod test {
             run(srv, doc)
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/rustdoc/reexport_pass.rs b/src/rustdoc/reexport_pass.rs
index ddbbf3d96d4..99f2e19149e 100644
--- a/src/rustdoc/reexport_pass.rs
+++ b/src/rustdoc/reexport_pass.rs
@@ -1,6 +1,7 @@
 #[doc = "Finds docs for reexported items and duplicates them"];
 
 import std::map;
+import std::map::hashmap;
 import rustc::syntax::ast;
 import rustc::syntax::ast_util;
 import rustc::util::common;
diff --git a/src/rustdoc/tystr_pass.rs b/src/rustdoc/tystr_pass.rs
index a7af2bb13ba..5e630ac2ade 100644
--- a/src/rustdoc/tystr_pass.rs
+++ b/src/rustdoc/tystr_pass.rs
@@ -4,6 +4,7 @@
 import rustc::syntax::ast;
 import rustc::syntax::print::pprust;
 import rustc::middle::ast_map;
+import std::map::hashmap;
 
 export mk_pass;
 
diff --git a/src/serializer/serializer.rs b/src/serializer/serializer.rs
index 90db74c4039..06684474c47 100644
--- a/src/serializer/serializer.rs
+++ b/src/serializer/serializer.rs
@@ -50,7 +50,7 @@ type ast_pat = str;
 type ast_ty = str;
 type ast_item = str;
 
-type tp_map = map<ast::node_id, ty::t>;
+type tp_map = hashmap<ast::node_id, ty::t>;
 
 type serialize_ctx = {
     crate: @ast::crate,
@@ -519,4 +519,4 @@ fn main(argv: [str]) {
     vec::iter(copy sctx.item_fns) {|item|
         stdout.write_str(#fmt["%s\n", item])
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs
index 984e8d78a18..6cf0d3e7ce3 100644
--- a/src/test/bench/shootout-mandelbrot.rs
+++ b/src/test/bench/shootout-mandelbrot.rs
@@ -14,6 +14,7 @@
 
 use std;
 import std::io::writer_util;
+import std::map::hashmap;
 
 type cmplx = {re: f64, im: f64};
 type line = {i: uint, b: [u8]};
diff --git a/src/test/bench/task-perf-word-count.rs b/src/test/bench/task-perf-word-count.rs
index a69a2d54c6f..d800b5e9a64 100644
--- a/src/test/bench/task-perf-word-count.rs
+++ b/src/test/bench/task-perf-word-count.rs
@@ -13,6 +13,7 @@ use std;
 import option = option;
 import option::{some, none};
 import std::{map, io, time};
+import std::map::hashmap;
 import io::reader_util;
 
 import comm::chan;
diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs
index f0c8bdf7b52..76c0807e69b 100644
--- a/src/test/compile-fail/map-types.rs
+++ b/src/test/compile-fail/map-types.rs
@@ -1,10 +1,12 @@
 use std;
 import std::map;
+import std::map::hashmap;
 import std::map::map;
 
 // Test that iface types printed in error msgs include the type arguments.
 
 fn main() {
-    let x: map<uint,str> = map::new_str_hash::<str>();
+    let x: map<str,str> = map::new_str_hash::<str>() as map::<str,str>;
+    let y: map<uint,str> = x;
     //!^ ERROR mismatched types: expected `std::map::map<uint,str>`
-}
\ No newline at end of file
+}
diff --git a/src/test/run-fail/unwind-misc-1.rs b/src/test/run-fail/unwind-misc-1.rs
index 365a1cbdcc6..532a911bd42 100644
--- a/src/test/run-fail/unwind-misc-1.rs
+++ b/src/test/run-fail/unwind-misc-1.rs
@@ -2,6 +2,7 @@
 
 use std;
 import std::map;
+import std::map::hashmap;
 import uint;
 
 fn main() {
@@ -21,4 +22,4 @@ fn main() {
         map.insert(arr, arr + [@"value stuff"]);
     }
     map.insert([@"boom"], []);
-}
\ No newline at end of file
+}
diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs
index bc16c319374..10f7388f720 100644
--- a/src/test/run-pass/hashmap-memory.rs
+++ b/src/test/run-pass/hashmap-memory.rs
@@ -12,6 +12,7 @@ import option::none;
 import str;
 import vec;
 import std::map;
+import std::map::hashmap;
 import task;
 import comm::chan;
 import comm::port;
diff --git a/src/test/run-pass/issue-1696.rs b/src/test/run-pass/issue-1696.rs
index f55e2fb8541..249f64d445d 100644
--- a/src/test/run-pass/issue-1696.rs
+++ b/src/test/run-pass/issue-1696.rs
@@ -1,5 +1,6 @@
 use std;
 import std::map;
+import std::map::hashmap;
 
 fn main() {
     let m = map::new_bytes_hash();