@@ -115,6 +115,7 @@ fn check_methods_against_iface(ccx: @crate_ctxt,
115
115
116
116
fn convert_class_item( ccx: @crate_ctxt,
117
117
rp: ast:: region_param,
118
+ bounds: @[ ty:: param_bounds] ,
118
119
v: ast_util:: ivar) {
119
120
/* we want to do something here, b/c within the
120
121
scope of the class, it's ok to refer to fields &
@@ -123,6 +124,8 @@ fn convert_class_item(ccx: @crate_ctxt,
123
124
class. outside the class, it's done with expr_field */
124
125
let tt = ccx. to_ty( type_rscope( rp) , v. ty) ;
125
126
write_ty_to_tcx( ccx. tcx, v. id, tt) ;
127
+ /* add the field to the tcache */
128
+ ccx. tcx. tcache. insert ( local_def( v. id) , { bounds : bounds, rp : rp, ty : tt} ) ;
126
129
}
127
130
128
131
fn convert_methods( ccx: @crate_ctxt,
@@ -228,6 +231,8 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
228
231
// Write the class type
229
232
let tpt = ty_of_item( ccx, it) ;
230
233
write_ty_to_tcx( tcx, it. id, tpt. ty) ;
234
+ tcx. tcache. insert ( local_def( it. id) , { bounds : tpt. bounds,
235
+ rp : rp, ty : tpt. ty} ) ;
231
236
// Write the ctor type
232
237
let t_ctor =
233
238
ty:: mk_fn(
@@ -264,7 +269,7 @@ fn convert(ccx: @crate_ctxt, it: @ast::item) {
264
269
// Write the type of each of the members
265
270
let ( fields, methods) = split_class_items( members) ;
266
271
for fields. each { |f|
267
- convert_class_item( ccx, rp, f) ;
272
+ convert_class_item( ccx, rp, tpt . bounds , f) ;
268
273
}
269
274
// The selfty is just the class type
270
275
let { bounds: _, substs} = mk_substs( ccx, tps, rp) ;
0 commit comments