Remove modes from map API and replace with regions.

API is (for now) mostly by value, there are options to use it by
reference if you like.  Hash and equality functions must be pure
and by reference (forward looking to the day when something
like send_map becomes the standard map).
This commit is contained in:
Niko Matsakis 2012-08-02 15:42:56 -07:00
parent 476ce459bd
commit 97452c0ca1
62 changed files with 578 additions and 473 deletions

View file

@ -230,18 +230,18 @@ pure fn is_call_expr(e: @expr) -> bool {
alt e.node { expr_call(_, _, _) { true } _ { false } }
}
fn eq_ty(&&a: @ty, &&b: @ty) -> bool { return box::ptr_eq(a, b); }
pure fn eq_ty(a: &@ty, b: &@ty) -> bool { box::ptr_eq(*a, *b) }
fn hash_ty(&&t: @ty) -> uint {
pure fn hash_ty(t: &@ty) -> uint {
let res = (t.span.lo << 16u) + t.span.hi;
return res;
}
fn def_eq(a: ast::def_id, b: ast::def_id) -> bool {
return a.crate == b.crate && a.node == b.node;
pure fn def_eq(a: &ast::def_id, b: &ast::def_id) -> bool {
a.crate == b.crate && a.node == b.node
}
fn hash_def(d: ast::def_id) -> uint {
pure fn hash_def(d: &ast::def_id) -> uint {
let mut h = 5381u;
h = (h << 5u) + h ^ (d.crate as uint);
h = (h << 5u) + h ^ (d.node as uint);