Skip to content

Commit 5cddd43

Browse files
committed
---
yaml --- r: 3736 b: refs/heads/master c: 00d5401 h: refs/heads/master v: v3
1 parent b07c287 commit 5cddd43

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 06391dda027ee656f8e96a4eeefe9651fb233f86
2+
refs/heads/master: 00d54018f15aa6ce6a913d0ae07d308f4b9ec5e5

trunk/src/comp/metadata/csearch.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Searching for information from the cstore
2+
13
import syntax::ast;
24
import middle::ty;
35
import std::io;

trunk/src/comp/metadata/decoder.rs

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Metadata decoding
1+
// Decoding metadata from a single crate's metadata
22

33
import std::ebml;
44
import std::ivec;
@@ -85,14 +85,21 @@ fn variant_tag_id(&ebml::doc d) -> ast::def_id {
8585
fn item_type(&ebml::doc item, ast::crate_num this_cnum,
8686
ty::ctxt tcx) -> ty::t {
8787
fn parse_external_def_id(ast::crate_num this_cnum, str s) -> ast::def_id {
88-
// FIXME: This is completely wrong when linking against a crate
89-
// that, in turn, links against another crate. We need a mapping
90-
// from crate ID to crate "meta" attributes as part of the crate
91-
// metadata:
92-
9388
auto buf = str::bytes(s);
9489
auto external_def_id = parse_def_id(buf);
95-
ret tup(this_cnum, external_def_id._1);
90+
91+
// This item was defined in the crate we're searching if it's has the
92+
// local crate number, otherwise we need to search a different crate
93+
if (external_def_id._0 == ast::local_crate) {
94+
ret tup(this_cnum, external_def_id._1);
95+
} else {
96+
// FIXME: This is completely wrong when linking against a crate
97+
// that, in turn, links against another crate. We need a mapping
98+
// from crate ID to crate "meta" attributes as part of the crate
99+
// metadata:
100+
fail "trying to load type info from a crate that is \
101+
defined in a different crate";
102+
}
96103
}
97104
auto tp = ebml::get_doc(item, tag_items_data_item_type);
98105
ret parse_ty_data(item.data, this_cnum, tp.start, tp.end - tp.start,

0 commit comments

Comments
 (0)