diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs index 8247d3102e3..0aefb60a597 100644 --- a/src/comp/metadata/encoder.rs +++ b/src/comp/metadata/encoder.rs @@ -280,10 +280,11 @@ fn encode_info_for_item(@crate_ctxt cx, &ebml::writer ebml_w, tps); } case (item_res(_, _, ?tps, ?ctor_id)) { - auto fn_ty = node_id_type(cx, item.id); + + auto fn_ty = node_id_type(cx, ctor_id); ebml::start_tag(ebml_w, tag_items_data_item); - encode_def_id(ebml_w, local_def(item.id)); + encode_def_id(ebml_w, local_def(ctor_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)); diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 95cd9d77b26..ea5da34c773 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -742,6 +742,7 @@ mod collect { t_res, ast::return, []); auto t_dtor = ty::mk_fn(cx.tcx, ast::proto_fn, [t_arg], ty::mk_nil(cx.tcx), ast::return, []); + write::ty_only(cx.tcx, it.id, t_res); write::ty_only(cx.tcx, ctor_id, t_ctor); cx.tcx.tcache.insert(local_def(ctor_id), tup(vec::len(tps), t_ctor));