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); } } }