Skip to content

Commit 9b88219

Browse files
committed
Don't attach def ids to types when the type already contains the def id
1 parent cc99ce5 commit 9b88219

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

src/rustc/middle/typeck.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -463,31 +463,22 @@ fn ty_of_item(tcx: ty::ctxt, mode: mode, it: @ast::item)
463463
ast::item_res(decl, tps, _, _, _) {
464464
let {bounds, params} = mk_ty_params(tcx, tps);
465465
let t_arg = ty_of_arg(tcx, mode, decl.inputs[0]);
466-
let t = {
467-
let t0 = ty::mk_res(tcx, local_def(it.id), t_arg.ty, params);
468-
ty::mk_with_id(tcx, t0, def_id)
469-
};
466+
let t = ty::mk_res(tcx, local_def(it.id), t_arg.ty, params);
470467
let t_res = {bounds: bounds, ty: t};
471468
tcx.tcache.insert(local_def(it.id), t_res);
472469
ret t_res;
473470
}
474471
ast::item_enum(_, tps) {
475472
// Create a new generic polytype.
476473
let {bounds, params} = mk_ty_params(tcx, tps);
477-
let t = {
478-
let t0 = ty::mk_enum(tcx, local_def(it.id), params);
479-
ty::mk_with_id(tcx, t0, def_id)
480-
};
474+
let t = ty::mk_enum(tcx, local_def(it.id), params);
481475
let tpt = {bounds: bounds, ty: t};
482476
tcx.tcache.insert(local_def(it.id), tpt);
483477
ret tpt;
484478
}
485479
ast::item_iface(tps, ms) {
486480
let {bounds, params} = mk_ty_params(tcx, tps);
487-
let t = {
488-
let t0 = ty::mk_iface(tcx, local_def(it.id), params);
489-
ty::mk_with_id(tcx, t0, def_id)
490-
};
481+
let t = ty::mk_iface(tcx, local_def(it.id), params);
491482
let tpt = {bounds: bounds, ty: t};
492483
tcx.tcache.insert(local_def(it.id), tpt);
493484
ret tpt;
@@ -920,7 +911,6 @@ mod collect {
920911
let def_id = local_def(it.id);
921912
let t_arg = ty_of_arg(tcx, m_collect, decl.inputs[0]);
922913
let t_res = ty::mk_res(tcx, def_id, t_arg.ty, params);
923-
let t_res = ty::mk_with_id(tcx, t_res, def_id);
924914
let t_ctor = ty::mk_fn(tcx, {
925915
proto: ast::proto_box,
926916
inputs: [{mode: ast::expl(ast::by_copy) with t_arg}],

src/rustc/util/ppaux.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
123123
}
124124
ty_enum(did, tps) | ty_res(did, _, tps) | ty_iface(did, tps) |
125125
ty_class(did, tps) {
126-
// Not sure why, but under some circumstances enum or resource types
127-
// do not have an associated id. I didn't investigate enough to know
128-
// if there is a good reason for this. - Niko, 2012-02-10
129126
let path = ty::item_path(cx, did);
130127
let base = ast_map::path_to_str(path);
131128
parameterized(cx, base, tps)

0 commit comments

Comments
 (0)