@@ -366,6 +366,10 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t {
366
366
367
367
fn ty_of_item ( tcx : ty:: ctxt , mode : mode , it : @ast:: item )
368
368
-> ty:: ty_param_bounds_and_ty {
369
+ alt tcx. tcache . find ( local_def ( it. id ) ) {
370
+ some ( tpt) { ret tpt; }
371
+ _ { }
372
+ }
369
373
alt it. node {
370
374
ast:: item_const ( t, _) {
371
375
let typ = ast_ty_to_ty ( tcx, mode, t) ;
@@ -740,6 +744,16 @@ mod collect {
740
744
write_ty ( cx. tcx , variant. node . id , result_ty) ;
741
745
}
742
746
}
747
+ fn ensure_iface_methods ( tcx : ty:: ctxt , id : ast:: node_id ) {
748
+ alt tcx. items . get ( id) {
749
+ ast_map:: node_item ( @{ node: ast:: item_iface ( _, ms) , _} , _) {
750
+ ty:: store_iface_methods ( tcx, id, @vec:: map ( ms, { |m|
751
+ ty_of_ty_method ( tcx, m_collect, m)
752
+ } ) ) ;
753
+ }
754
+ _ { fail; }
755
+ }
756
+ }
743
757
fn convert ( cx : @ctxt , it : @ast:: item ) {
744
758
alt it. node {
745
759
// These don't define types.
@@ -771,6 +785,9 @@ mod collect {
771
785
{ bounds: i_bounds, ty: iface_ty} ) ;
772
786
alt ty:: struct ( cx. tcx , iface_ty) {
773
787
ty:: ty_iface ( did, tys) {
788
+ if did. crate == ast:: local_crate {
789
+ ensure_iface_methods ( cx. tcx , did. node ) ;
790
+ }
774
791
for if_m in * ty:: iface_methods ( cx. tcx , did) {
775
792
alt vec:: find ( my_methods,
776
793
{ |m| if_m. ident == m. mty . ident } ) {
@@ -827,9 +844,7 @@ mod collect {
827
844
ast:: item_iface ( _, ms) {
828
845
let tpt = ty_of_item ( cx. tcx , m_collect, it) ;
829
846
write_ty ( cx. tcx , it. id , tpt. ty ) ;
830
- ty:: store_iface_methods ( cx. tcx , it. id , @vec:: map ( ms, { |m|
831
- ty_of_ty_method ( cx. tcx , m_collect, m)
832
- } ) ) ;
847
+ ensure_iface_methods ( cx. tcx , it. id ) ;
833
848
}
834
849
_ {
835
850
// This call populates the type cache with the converted type
0 commit comments