From 36fb7544761aed081c0dc5b5cf3f9d0267752e53 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 27 Jun 2011 12:18:51 -0700 Subject: [PATCH] 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' --- src/comp/middle/metadata.rs | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/comp/middle/metadata.rs b/src/comp/middle/metadata.rs index ae59a208fa3e..1b71771238c1 100644 --- a/src/comp/middle/metadata.rs +++ b/src/comp/middle/metadata.rs @@ -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); } } }