Skip to content

Commit a62bd9a

Browse files
committed
Work around recursive type check for iface types
They are nominal, and can safely refer to themselves.
1 parent c13f087 commit a62bd9a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/comp/middle/typeck.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,6 @@ fn ty_of_item(tcx: ty::ctxt, mode: mode, it: @ast::item)
430430
@it.ident);
431431
let tpt = {bounds: bounds, ty: t};
432432
tcx.tcache.insert(local_def(it.id), tpt);
433-
ty::store_iface_methods(tcx, it.id, @vec::map(ms, {|m|
434-
ty_of_ty_method(tcx, m_collect, m)
435-
}));
436433
ret tpt;
437434
}
438435
ast::item_impl(_, _, _, _) | ast::item_mod(_) |
@@ -818,6 +815,13 @@ mod collect {
818815
{bounds: bounds, ty: t_ctor});
819816
write::ty_only(cx.tcx, dtor_id, t_dtor);
820817
}
818+
ast::item_iface(_, ms) {
819+
let tpt = ty_of_item(cx.tcx, m_collect, it);
820+
write::ty_only(cx.tcx, it.id, tpt.ty);
821+
ty::store_iface_methods(cx.tcx, it.id, @vec::map(ms, {|m|
822+
ty_of_ty_method(cx.tcx, m_collect, m)
823+
}));
824+
}
821825
_ {
822826
// This call populates the type cache with the converted type
823827
// of the item in passing. All we have to do here is to write

0 commit comments

Comments
 (0)