Skip to content

Commit 75d3e3c

Browse files
committed
rustc: Remove a user of tag_paths.
This commit breaks the item-printing functionality. It will return in a faster form.
1 parent eb834fd commit 75d3e3c

File tree

2 files changed

+11
-31
lines changed

2 files changed

+11
-31
lines changed

src/rustc/metadata/cstore.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn get_crate_vers(cstore: cstore, cnum: ast::crate_num) -> @~str {
9696
fn set_crate_data(cstore: cstore, cnum: ast::crate_num,
9797
data: crate_metadata) {
9898
p(cstore).metas.insert(cnum, data);
99-
do vec::iter(decoder::get_crate_module_paths(data.data)) |dp| {
99+
do vec::iter(decoder::get_crate_module_paths(data)) |dp| {
100100
let (did, path) = dp;
101101
let d = {crate: cnum, node: did.node};
102102
p(cstore).mod_path_map.insert(d, @path);

src/rustc/metadata/decoder.rs

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -919,37 +919,18 @@ fn get_crate_vers(data: @~[u8]) -> @~str {
919919
};
920920
}
921921

922-
fn list_crate_items(bytes: @~[u8], md: ebml::doc, out: io::Writer) {
923-
out.write_str(~"=Items=\n");
924-
let items = ebml::get_doc(md, tag_items);
925-
do iter_crate_items(bytes) |tag, path, did| {
926-
// Don't print out any metadata info about intrinsics
927-
if tag != tag_paths_foreign_path {
928-
out.write_str(fmt!{"%s (%s)\n", path,
929-
describe_def(items, did)});
930-
}
922+
fn iter_crate_items(cdata: cmd, proc: fn(~str, ast::def_id)) {
923+
for each_path(cdata) |path_entry| {
924+
match path_entry.def_like {
925+
dl_impl(*) | dl_field => {}
926+
dl_def(def) => {
927+
proc(path_entry.path_string, ast_util::def_id_of_def(def))
928+
}
929+
}
931930
}
932-
out.write_str(~"\n");
933-
}
934-
935-
fn iter_crate_items(bytes: @~[u8], proc: fn(uint, ~str, ast::def_id)) {
936-
let md = ebml::doc(bytes);
937-
let paths = ebml::get_doc(md, tag_paths);
938-
let index = ebml::get_doc(paths, tag_index);
939-
let bs = ebml::get_doc(index, tag_index_buckets);
940-
for ebml::tagged_docs(bs, tag_index_buckets_bucket) |bucket| {
941-
let et = tag_index_buckets_bucket_elt;
942-
for ebml::tagged_docs(bucket, et) |elt| {
943-
let data = read_path(elt);
944-
let {tag:t, doc:def} = ebml::doc_at(bytes, data.pos);
945-
let did_doc = ebml::get_doc(def, tag_def_id);
946-
let did = ebml::with_doc_data(did_doc, |d| parse_def_id(d));
947-
proc(t, data.path, did);
948-
};
949-
};
950931
}
951932

952-
fn get_crate_module_paths(bytes: @~[u8]) -> ~[(ast::def_id, ~str)] {
933+
fn get_crate_module_paths(cdata: cmd) -> ~[(ast::def_id, ~str)] {
953934
fn mod_of_path(p: ~str) -> ~str {
954935
str::connect(vec::init(str::split_str(p, ~"::")), ~"::")
955936
}
@@ -958,7 +939,7 @@ fn get_crate_module_paths(bytes: @~[u8]) -> ~[(ast::def_id, ~str)] {
958939
// fowarded path due to renamed import or reexport
959940
let mut res = ~[];
960941
let mods = map::str_hash();
961-
do iter_crate_items(bytes) |_tag, path, did| {
942+
do iter_crate_items(cdata) |path, did| {
962943
let m = mod_of_path(path);
963944
if str::is_not_empty(m) {
964945
// if m has a sub-item, it must be a module
@@ -980,7 +961,6 @@ fn list_crate_metadata(bytes: @~[u8], out: io::Writer) {
980961
let md = ebml::doc(bytes);
981962
list_crate_attributes(md, hash, out);
982963
list_crate_deps(bytes, out);
983-
list_crate_items(bytes, md, out);
984964
}
985965

986966
// Translates a def_id from an external crate to a def_id for the current

0 commit comments

Comments
 (0)