@@ -420,11 +420,11 @@ fn ast_ty_to_ty(tcx: ty::ctxt, mode: mode, &&ast_ty: @ast::ty) -> ty::t {
420
420
421
421
fn ty_of_item ( tcx : ty:: ctxt , mode : mode , it : @ast:: item )
422
422
-> ty:: ty_param_bounds_and_ty {
423
- alt tcx. tcache . find ( local_def ( it. id ) ) {
423
+ let def_id = local_def ( it. id ) ;
424
+ alt tcx. tcache . find ( def_id) {
424
425
some ( tpt) { ret tpt; }
425
426
_ { }
426
427
}
427
- let def_id = { crate : ast:: local_crate, node: it. id } ;
428
428
alt it. node {
429
429
ast:: item_const ( t, _) {
430
430
let typ = ast_ty_to_ty ( tcx, mode, t) ;
@@ -917,9 +917,10 @@ mod collect {
917
917
}
918
918
ast:: item_res ( decl, tps, _, dtor_id, ctor_id) {
919
919
let { bounds, params} = mk_ty_params ( tcx, tps) ;
920
+ let def_id = local_def ( it. id ) ;
920
921
let t_arg = ty_of_arg ( tcx, m_collect, decl. inputs [ 0 ] ) ;
921
- let t_res = ty:: mk_res ( tcx, local_def ( it . id ) , t_arg. ty ,
922
- params ) ;
922
+ 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 ) ;
923
924
let t_ctor = ty:: mk_fn ( tcx, {
924
925
proto: ast:: proto_box,
925
926
inputs: [ { mode: ast:: expl ( ast:: by_copy) with t_arg} ] ,
@@ -934,7 +935,8 @@ mod collect {
934
935
write_ty ( tcx, it. id , t_res) ;
935
936
write_ty ( tcx, ctor_id, t_ctor) ;
936
937
tcx. tcache . insert ( local_def ( ctor_id) ,
937
- { bounds: bounds, ty: t_ctor} ) ;
938
+ { bounds: bounds, ty: t_ctor} ) ;
939
+ tcx. tcache . insert ( def_id, { bounds: bounds, ty: t_res} ) ;
938
940
write_ty ( tcx, dtor_id, t_dtor) ;
939
941
}
940
942
ast:: item_iface ( _, ms) {
0 commit comments