Skip to content

Commit 030e55c

Browse files
committed
---
yaml --- r: 12991 b: refs/heads/master c: 4756556 h: refs/heads/master i: 12989: d2558a2 12987: c3c9fd4 12983: a0b1963 12975: c81d057 12959: 1ccee08 12927: bc1d0bb v: v3
1 parent e45fff8 commit 030e55c

File tree

12 files changed

+36
-36
lines changed

12 files changed

+36
-36
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 8ec467d521e6e39f80a0c74c049a5aa719a01dde
2+
refs/heads/master: 4756556748fe7fa247c02f36dc481c8eeae9908d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/librustsyntax/ast_util.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,23 @@ fn hash_ty(&&t: @ty) -> uint {
225225
ret res;
226226
}
227227

228+
fn def_eq(a: ast::def_id, b: ast::def_id) -> bool {
229+
ret a.crate == b.crate && a.node == b.node;
230+
}
231+
232+
fn hash_def(d: ast::def_id) -> uint {
233+
let mut h = 5381u;
234+
h = (h << 5u) + h ^ (d.crate as uint);
235+
h = (h << 5u) + h ^ (d.node as uint);
236+
ret h;
237+
}
238+
239+
fn new_def_hash<V: copy>() -> std::map::hashmap<ast::def_id, V> {
240+
let hasher: std::map::hashfn<ast::def_id> = hash_def;
241+
let eqer: std::map::eqfn<ast::def_id> = def_eq;
242+
ret std::map::hashmap::<ast::def_id, V>(hasher, eqer);
243+
}
244+
228245
fn hash_def_id(&&id: def_id) -> uint {
229246
(id.crate as uint << 16u) + (id.node as uint)
230247
}

trunk/src/rustc/metadata/cstore.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import std::map;
55
import std::map::hashmap;
66
import syntax::{ast, attr};
7+
import syntax::ast_util::new_def_hash;
78
import util::common::*;
89

910
export cstore::{};

trunk/src/rustc/middle/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ import middle::ty;
137137
import syntax::{ast, visit};
138138
import syntax::codemap::span;
139139
import syntax::print::pprust;
140-
import util::common::new_def_hash;
140+
import syntax::ast_util::new_def_hash;
141141

142142
import std::list;
143143
import std::list::list;

trunk/src/rustc/middle/resolve.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import syntax::{ast, ast_util, codemap, ast_map};
22
import syntax::ast::*;
33
import ast::{ident, fn_ident, def, def_id, node_id};
4-
import syntax::ast_util::{local_def, def_id_of_def,
4+
import syntax::ast_util::{local_def, def_id_of_def, new_def_hash,
55
class_item_ident, path_to_ident};
66
import pat_util::*;
77

@@ -73,10 +73,10 @@ type ext_hash = hashmap<{did: def_id, ident: str, ns: namespace}, def>;
7373
fn new_ext_hash() -> ext_hash {
7474
type key = {did: def_id, ident: str, ns: namespace};
7575
fn hash(v: key) -> uint {
76-
str::hash(v.ident) + util::common::hash_def(v.did) + v.ns as uint
76+
str::hash(v.ident) + ast_util::hash_def(v.did) + v.ns as uint
7777
}
7878
fn eq(v1: key, v2: key) -> bool {
79-
ret util::common::def_eq(v1.did, v2.did) &&
79+
ret ast_util::def_eq(v1.did, v2.did) &&
8080
str::eq(v1.ident, v2.ident) && v1.ns == v2.ns;
8181
}
8282
std::map::hashmap(hash, {|a, b| a == b})

trunk/src/rustc/middle/trans/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5492,10 +5492,10 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
54925492
discrims: ast_util::new_def_id_hash::<ValueRef>(),
54935493
discrim_symbols: int_hash::<str>(),
54945494
tydescs: ty::new_ty_hash(),
5495-
external: util::common::new_def_hash(),
5495+
external: ast_util::new_def_hash(),
54965496
monomorphized: map::hashmap(hash_mono_id, {|a, b| a == b}),
54975497
monomorphizing: ast_util::new_def_id_hash(),
5498-
type_use_cache: util::common::new_def_hash(),
5498+
type_use_cache: ast_util::new_def_hash(),
54995499
vtables: map::hashmap(hash_mono_id, {|a, b| a == b}),
55005500
const_cstr_cache: map::str_hash(),
55015501
module_data: str_hash::<ValueRef>(),

trunk/src/rustc/middle/trans/shape.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import back::abi;
1111
import middle::ty;
1212
import middle::ty::field;
1313
import syntax::ast;
14-
import syntax::ast_util::dummy_sp;
14+
import syntax::ast_util::{dummy_sp, new_def_hash};
1515
import syntax::util::interner;
1616
import util::common;
1717
import syntax::codemap::span;
@@ -273,7 +273,7 @@ fn mk_ctxt(llmod: ModuleRef) -> ctxt {
273273

274274
ret {mut next_tag_id: 0u16,
275275
pad: 0u16,
276-
tag_id_to_index: common::new_def_hash(),
276+
tag_id_to_index: new_def_hash(),
277277
tag_order: dvec(),
278278
resources: interner::mk(hash_res_info, {|a, b| a == b}),
279279
llshapetablesty: llshapetablesty,

trunk/src/rustc/middle/tstate/collect_locals.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import pat_util::*;
33
import syntax::ast::*;
44
import syntax::ast_util::*;
55
import syntax::visit;
6-
import util::common::new_def_hash;
76
import syntax::codemap::span;
87
import syntax::ast_util::respan;
98
import driver::session::session;

trunk/src/rustc/middle/tstate/pre_post_conditions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import pat_util::*;
99
import syntax::ast::*;
1010
import syntax::ast_util::*;
1111
import syntax::visit;
12-
import util::common::{new_def_hash, log_expr, field_exprs,
12+
import util::common::{log_expr, field_exprs,
1313
has_nonlocal_exits, log_stmt};
1414
import syntax::codemap::span;
1515
import driver::session::session;

trunk/src/rustc/middle/ty.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import session::session;
66
import syntax::{ast, ast_map};
77
import syntax::ast::*;
88
import syntax::ast_util;
9-
import syntax::ast_util::{is_local, local_def, split_class_items};
9+
import syntax::ast_util::{is_local, local_def, split_class_items,
10+
new_def_hash};
1011
import syntax::codemap::span;
1112
import metadata::csearch;
1213
import util::common::*;
@@ -478,7 +479,7 @@ fn mk_ctxt(s: session::session, dm: resolve::def_map, amap: ast_map::map,
478479
items: amap,
479480
intrinsic_ifaces: map::str_hash(),
480481
freevars: freevars,
481-
tcache: new_def_hash(),
482+
tcache: ast_util::new_def_hash(),
482483
rcache: mk_rcache(),
483484
short_names_cache: new_ty_hash(),
484485
needs_drop_cache: new_ty_hash(),
@@ -2524,7 +2525,7 @@ fn enum_variant_with_id(cx: ctxt, enum_id: ast::def_id,
25242525
let mut i = 0u;
25252526
while i < vec::len::<variant_info>(*variants) {
25262527
let variant = variants[i];
2527-
if def_eq(variant.id, variant_id) { ret variant; }
2528+
if ast_util::def_eq(variant.id, variant_id) { ret variant; }
25282529
i += 1u;
25292530
}
25302531
cx.sess.bug("enum_variant_with_id(): no variant exists with that ID");

trunk/src/rustc/util/common.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,6 @@ fn indenter() -> _indenter {
2525

2626
type flag = hashmap<str, ()>;
2727

28-
fn def_eq(a: ast::def_id, b: ast::def_id) -> bool {
29-
ret a.crate == b.crate && a.node == b.node;
30-
}
31-
32-
fn hash_def(d: ast::def_id) -> uint {
33-
let mut h = 5381u;
34-
h = (h << 5u) + h ^ (d.crate as uint);
35-
h = (h << 5u) + h ^ (d.node as uint);
36-
ret h;
37-
}
38-
39-
fn new_def_hash<V: copy>() -> std::map::hashmap<ast::def_id, V> {
40-
let hasher: std::map::hashfn<ast::def_id> = hash_def;
41-
let eqer: std::map::eqfn<ast::def_id> = def_eq;
42-
ret std::map::hashmap::<ast::def_id, V>(hasher, eqer);
43-
}
44-
4528
fn field_expr(f: ast::field) -> @ast::expr { ret f.node.expr; }
4629

4730
fn field_exprs(fields: [ast::field]) -> [@ast::expr] {

trunk/src/rustdoc/reexport_pass.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import std::map::hashmap;
55
import std::list;
66
import syntax::ast;
77
import syntax::ast_util;
8-
import rustc::util::common;
98
import syntax::ast_map;
109
import syntax::visit;
1110
import syntax::codemap;
@@ -69,7 +68,7 @@ fn from_assoc_list<K:copy, V:copy>(
6968
fn from_def_assoc_list<V:copy>(
7069
list: [(ast::def_id, V)]
7170
) -> map::hashmap<ast::def_id, V> {
72-
from_assoc_list(list, bind common::new_def_hash())
71+
from_assoc_list(list, bind ast_util::new_def_hash())
7372
}
7473

7574
fn from_str_assoc_list<V:copy>(
@@ -80,7 +79,7 @@ fn from_str_assoc_list<V:copy>(
8079

8180
fn build_reexport_def_set(srv: astsrv::srv) -> def_set {
8281
let assoc_list = astsrv::exec(srv) {|ctxt|
83-
let def_set = common::new_def_hash();
82+
let def_set = ast_util::new_def_hash();
8483
for ctxt.exp_map.each {|_id, defs|
8584
for defs.each {|def|
8685
if def.reexp {
@@ -120,7 +119,7 @@ fn build_reexport_def_map(
120119
let ctxt = {
121120
srv: srv,
122121
def_set: def_set,
123-
def_map: common::new_def_hash()
122+
def_map: ast_util::new_def_hash()
124123
};
125124

126125
// FIXME: Do a parallel fold
@@ -289,7 +288,7 @@ fn for_each_reexported_impl(
289288
}
290289

291290
fn all_impls(m: ast::_mod) -> map::set<ast::def_id> {
292-
let all_impls = common::new_def_hash();
291+
let all_impls = ast_util::new_def_hash();
293292
for m.items.each {|item|
294293
alt item.node {
295294
ast::item_impl(_, _, _, _, _) {

0 commit comments

Comments
 (0)