Index obj and res ctor metadata by ctor id, not item id

Both the type and the ctor were trying to use the same id and this was making
creader unable to find the ctor when running 'rustc --ls'
This commit is contained in:
Brian Anderson 2011-06-27 12:18:51 -07:00
parent b55277002b
commit 36fb754476

View file

@ -572,38 +572,42 @@ fn encode_info_for_item(@trans::crate_ctxt cx, &ebml::writer ebml_w,
tps);
}
case (item_res(_, _, ?tps, ?ctor_id)) {
ebml::start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, local_def(ctor_id));
encode_kind(ebml_w, 'f' as u8);
encode_type_param_count(ebml_w, tps);
auto fn_ty = trans::node_id_type(cx, item.id);
encode_type(cx, ebml_w, fn_ty);
encode_symbol(cx, ebml_w, ctor_id);
ebml::end_tag(ebml_w);
index += [tup(item.id, ebml_w.writer.tell())];
ebml::start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, local_def(item.id));
encode_kind(ebml_w, 'y' as u8);
encode_type_param_count(ebml_w, tps);
encode_type(cx, ebml_w, ty::ty_fn_ret(cx.tcx, fn_ty));
ebml::end_tag(ebml_w);
index += [tup(ctor_id, ebml_w.writer.tell())];
ebml::start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, local_def(ctor_id));
encode_kind(ebml_w, 'f' as u8);
encode_type_param_count(ebml_w, tps);
encode_type(cx, ebml_w, fn_ty);
encode_symbol(cx, ebml_w, ctor_id);
ebml::end_tag(ebml_w);
}
case (item_obj(_, ?tps, ?ctor_id)) {
ebml::start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, local_def(ctor_id));
encode_kind(ebml_w, 'f' as u8);
encode_type_param_count(ebml_w, tps);
auto fn_ty = trans::node_id_type(cx, ctor_id);
encode_type(cx, ebml_w, fn_ty);
encode_symbol(cx, ebml_w, ctor_id);
ebml::end_tag(ebml_w);
index += [tup(item.id, ebml_w.writer.tell())];
ebml::start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, local_def(item.id));
encode_kind(ebml_w, 'y' as u8);
encode_type_param_count(ebml_w, tps);
encode_type(cx, ebml_w, ty::ty_fn_ret(cx.tcx, fn_ty));
ebml::end_tag(ebml_w);
index += [tup(ctor_id, ebml_w.writer.tell())];
ebml::start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, local_def(ctor_id));
encode_kind(ebml_w, 'f' as u8);
encode_type_param_count(ebml_w, tps);
encode_type(cx, ebml_w, fn_ty);
encode_symbol(cx, ebml_w, ctor_id);
ebml::end_tag(ebml_w);
}
}
}