about summary refs log tree commit diff
path: root/src/rustc
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2012-03-01 23:38:25 +0100
committerMarijn Haverbeke <marijnh@gmail.com>2012-03-06 14:00:13 +0100
commit9b882197233c06454e376fd80adca7f4a80264ca (patch)
tree3d2fba4f3bada2416a2b04df4f2e4b69526c6feb /src/rustc
parentcc99ce5bdd64942736e9db24244f2edded69610a (diff)
downloadrust-9b882197233c06454e376fd80adca7f4a80264ca.tar.gz
rust-9b882197233c06454e376fd80adca7f4a80264ca.zip
Don't attach def ids to types when the type already contains the def id
Diffstat (limited to 'src/rustc')
-rw-r--r--src/rustc/middle/typeck.rs16
-rw-r--r--src/rustc/util/ppaux.rs3
2 files changed, 3 insertions, 16 deletions
diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs
index ee147788e40..33be02a1586 100644
--- a/src/rustc/middle/typeck.rs
+++ b/src/rustc/middle/typeck.rs
@@ -463,10 +463,7 @@ fn ty_of_item(tcx: ty::ctxt, mode: mode, it: @ast::item)
       ast::item_res(decl, tps, _, _, _) {
         let {bounds, params} = mk_ty_params(tcx, tps);
         let t_arg = ty_of_arg(tcx, mode, decl.inputs[0]);
-        let t = {
-            let t0 = ty::mk_res(tcx, local_def(it.id), t_arg.ty, params);
-            ty::mk_with_id(tcx, t0, def_id)
-        };
+        let t = ty::mk_res(tcx, local_def(it.id), t_arg.ty, params);
         let t_res = {bounds: bounds, ty: t};
         tcx.tcache.insert(local_def(it.id), t_res);
         ret t_res;
@@ -474,20 +471,14 @@ fn ty_of_item(tcx: ty::ctxt, mode: mode, it: @ast::item)
       ast::item_enum(_, tps) {
         // Create a new generic polytype.
         let {bounds, params} = mk_ty_params(tcx, tps);
-        let t = {
-            let t0 = ty::mk_enum(tcx, local_def(it.id), params);
-            ty::mk_with_id(tcx, t0, def_id)
-        };
+        let t = ty::mk_enum(tcx, local_def(it.id), params);
         let tpt = {bounds: bounds, ty: t};
         tcx.tcache.insert(local_def(it.id), tpt);
         ret tpt;
       }
       ast::item_iface(tps, ms) {
         let {bounds, params} = mk_ty_params(tcx, tps);
-        let t = {
-            let t0 = ty::mk_iface(tcx, local_def(it.id), params);
-            ty::mk_with_id(tcx, t0, def_id)
-        };
+        let t = ty::mk_iface(tcx, local_def(it.id), params);
         let tpt = {bounds: bounds, ty: t};
         tcx.tcache.insert(local_def(it.id), tpt);
         ret tpt;
@@ -920,7 +911,6 @@ mod collect {
             let def_id = local_def(it.id);
             let t_arg = ty_of_arg(tcx, m_collect, decl.inputs[0]);
             let t_res = ty::mk_res(tcx, def_id, t_arg.ty, params);
-            let t_res = ty::mk_with_id(tcx, t_res, def_id);
             let t_ctor = ty::mk_fn(tcx, {
                 proto: ast::proto_box,
                 inputs: [{mode: ast::expl(ast::by_copy) with t_arg}],
diff --git a/src/rustc/util/ppaux.rs b/src/rustc/util/ppaux.rs
index 20134993047..9ebcce1b9a8 100644
--- a/src/rustc/util/ppaux.rs
+++ b/src/rustc/util/ppaux.rs
@@ -123,9 +123,6 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
       }
       ty_enum(did, tps) | ty_res(did, _, tps) | ty_iface(did, tps) |
       ty_class(did, tps) {
-        // Not sure why, but under some circumstances enum or resource types
-        // do not have an associated id.  I didn't investigate enough to know
-        // if there is a good reason for this. - Niko, 2012-02-10
         let path = ty::item_path(cx, did);
         let base = ast_map::path_to_str(path);
         parameterized(cx, base, tps)