Skip to content

Commit 3bdccdb

Browse files
committed
---
yaml --- r: 2465 b: refs/heads/master c: 7f22242 h: refs/heads/master i: 2463: 03dc3a5 v: v3
1 parent 135c03c commit 3bdccdb

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 6b46113afc92b39594922589e768b98c854eda8d
2+
refs/heads/master: 7f222423b7795cd8788b59a34542f19745bd4863

trunk/src/comp/driver/rustc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn compile_input(session.session sess,
8585
eval.env env,
8686
str input, str output) {
8787
auto time_passes = sess.get_opts().time_passes;
88-
auto def = tup(0, 0);
88+
auto def = tup(ast.local_crate, 0);
8989
auto p = parser.new_parser(sess, env, def, input, 0u);
9090
auto crate = time[@ast.crate](time_passes, "parsing",
9191
bind parse_input(sess, p, input));
@@ -120,7 +120,7 @@ fn compile_input(session.session sess,
120120
fn pretty_print_input(session.session sess,
121121
eval.env env,
122122
str input) {
123-
auto def = tup(0, 0);
123+
auto def = tup(ast.local_crate, 0);
124124
auto p = front.parser.new_parser(sess, env, def, input, 0u);
125125
auto crate = front.parser.parse_crate_from_source_file(p);
126126
pretty.pprust.print_file(crate.node.module, input, std.IO.stdout());

trunk/src/comp/front/ast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type path_ = rec(vec[ident] idents, vec[@ty] types);
1515
type path = spanned[path_];
1616

1717
type crate_num = int;
18+
const crate_num local_crate = 0;
1819
type def_num = int;
1920
type def_id = tup(crate_num, def_num);
2021

trunk/src/comp/middle/resolve.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,7 @@ fn lookup_in_mod_strict(&env e, def m, &span sp, ident id,
591591
fn lookup_in_mod(&env e, def m, ident id, namespace ns, dir dr)
592592
-> Option.t[def] {
593593
auto defid = ast.def_id_of_def(m);
594-
// FIXME this causes way more metadata lookups than needed. Cache?
595-
if (defid._0 != 0) { // Not in this crate (FIXME use a const, not 0)
594+
if (defid._0 != ast.local_crate) { // Not in this crate
596595
auto cached = e.ext_cache.find(tup(defid,id));
597596
if (cached != none[def] && check_def_by_ns(Option.get(cached), ns)) {
598597
ret cached;

0 commit comments

Comments
 (0)