]> git.lizzy.rs Git - rust.git/commitdiff
Work around recursive type check for iface types
authorMarijn Haverbeke <marijnh@gmail.com>
Mon, 9 Jan 2012 15:07:35 +0000 (16:07 +0100)
committerMarijn Haverbeke <marijnh@gmail.com>
Mon, 9 Jan 2012 15:25:39 +0000 (16:25 +0100)
They are nominal, and can safely refer to themselves.

src/comp/middle/typeck.rs

index 540bae5b32b59abd73bf0bb593ecbd0b550a7f50..ee97ce4a15f62f20c53887938bd8b1e6465f31f5 100644 (file)
@@ -430,9 +430,6 @@ fn ty_of_item(tcx: ty::ctxt, mode: mode, it: @ast::item)
                              @it.ident);
         let tpt = {bounds: bounds, ty: t};
         tcx.tcache.insert(local_def(it.id), tpt);
-        ty::store_iface_methods(tcx, it.id, @vec::map(ms, {|m|
-            ty_of_ty_method(tcx, m_collect, m)
-        }));
         ret tpt;
       }
       ast::item_impl(_, _, _, _) | ast::item_mod(_) |
@@ -818,6 +815,13 @@ fn convert(cx: @ctxt, it: @ast::item) {
                                  {bounds: bounds, ty: t_ctor});
             write::ty_only(cx.tcx, dtor_id, t_dtor);
           }
+          ast::item_iface(_, ms) {
+            let tpt = ty_of_item(cx.tcx, m_collect, it);
+            write::ty_only(cx.tcx, it.id, tpt.ty);
+            ty::store_iface_methods(cx.tcx, it.id, @vec::map(ms, {|m|
+                ty_of_ty_method(cx.tcx, m_collect, m)
+            }));
+          }
           _ {
             // This call populates the type cache with the converted type
             // of the item in passing. All we have to do here is to write