@@ -183,18 +183,17 @@ fn encode_family(ebml_w: ebml::writer, c: u8) {
183
183
184
184
fn def_to_str ( did : def_id ) -> str { ret #fmt[ "%d:%d" , did. crate , did. node ] ; }
185
185
186
- fn encode_type_param_kinds ( ebml_w : ebml:: writer , tps : [ ty_param ] ) {
187
- ebml :: start_tag ( ebml_w , tag_items_data_item_ty_param_kinds ) ;
188
- ebml :: write_vint ( ebml_w . writer , vec :: len :: < ty_param > ( tps ) ) ;
189
- for tp : ty_param in tps {
190
- let c = alt ast_util :: ty_param_kind ( tp ) {
191
- kind_sendable . { 's' }
192
- kind_copyable . { 'c' }
193
- kind_noncopyable . { 'a' }
194
- } ;
195
- ebml_w . writer . write ( [ c as u8 ] ) ;
186
+ fn encode_type_param_bounds ( ebml_w : ebml:: writer , ecx : @ encode_ctxt ,
187
+ params : [ ty_param ] ) {
188
+ let ty_str_ctxt = @ { ds : def_to_str ,
189
+ tcx : ecx . ccx . tcx ,
190
+ abbrevs : tyencode :: ac_use_abbrevs ( ecx . type_abbrevs ) } ;
191
+ for param in params {
192
+ ebml :: start_tag ( ebml_w , tag_items_data_item_ty_param_bounds ) ;
193
+ let bs = ecx . ccx . tcx . ty_param_bounds . get ( local_def ( param . id ) ) ;
194
+ tyencode :: enc_bounds ( io :: new_writer ( ebml_w . writer ) , ty_str_ctxt , bs ) ;
195
+ ebml :: end_tag ( ebml_w ) ;
196
196
}
197
- ebml:: end_tag ( ebml_w) ;
198
197
}
199
198
200
199
fn encode_variant_id ( ebml_w : ebml:: writer , vid : def_id ) {
@@ -205,9 +204,8 @@ fn encode_variant_id(ebml_w: ebml::writer, vid: def_id) {
205
204
206
205
fn encode_type ( ecx : @encode_ctxt , ebml_w : ebml:: writer , typ : ty:: t ) {
207
206
ebml:: start_tag ( ebml_w, tag_items_data_item_type) ;
208
- let f = def_to_str;
209
207
let ty_str_ctxt =
210
- @{ ds: f ,
208
+ @{ ds: def_to_str ,
211
209
tcx: ecx. ccx . tcx ,
212
210
abbrevs: tyencode:: ac_use_abbrevs ( ecx. type_abbrevs ) } ;
213
211
tyencode:: enc_ty ( io:: new_writer ( ebml_w. writer ) , ty_str_ctxt, typ) ;
@@ -247,7 +245,7 @@ fn encode_tag_variant_info(ecx: @encode_ctxt, ebml_w: ebml::writer,
247
245
encode_symbol ( ecx, ebml_w, variant. node . id ) ;
248
246
}
249
247
encode_discriminant ( ecx, ebml_w, variant. node . id ) ;
250
- encode_type_param_kinds ( ebml_w, ty_params) ;
248
+ encode_type_param_bounds ( ebml_w, ecx , ty_params) ;
251
249
ebml:: end_tag ( ebml_w) ;
252
250
}
253
251
}
@@ -293,7 +291,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
293
291
pure_fn. { 'p' }
294
292
impure_fn. { 'f' }
295
293
} as u8 ) ;
296
- encode_type_param_kinds ( ebml_w, tps) ;
294
+ encode_type_param_bounds ( ebml_w, ecx , tps) ;
297
295
encode_type ( ecx, ebml_w, node_id_to_monotype ( ecx. ccx . tcx , item. id ) ) ;
298
296
encode_symbol ( ecx, ebml_w, item. id ) ;
299
297
ebml:: end_tag ( ebml_w) ;
@@ -312,7 +310,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
312
310
ebml:: start_tag ( ebml_w, tag_items_data_item) ;
313
311
encode_def_id ( ebml_w, local_def ( item. id ) ) ;
314
312
encode_family ( ebml_w, 'y' as u8 ) ;
315
- encode_type_param_kinds ( ebml_w, tps) ;
313
+ encode_type_param_bounds ( ebml_w, ecx , tps) ;
316
314
encode_type ( ecx, ebml_w, node_id_to_monotype ( ecx. ccx . tcx , item. id ) ) ;
317
315
encode_name ( ebml_w, item. ident ) ;
318
316
ebml:: end_tag ( ebml_w) ;
@@ -321,7 +319,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
321
319
ebml:: start_tag ( ebml_w, tag_items_data_item) ;
322
320
encode_def_id ( ebml_w, local_def ( item. id ) ) ;
323
321
encode_family ( ebml_w, 't' as u8 ) ;
324
- encode_type_param_kinds ( ebml_w, tps) ;
322
+ encode_type_param_bounds ( ebml_w, ecx , tps) ;
325
323
encode_type ( ecx, ebml_w, node_id_to_monotype ( ecx. ccx . tcx , item. id ) ) ;
326
324
encode_name ( ebml_w, item. ident ) ;
327
325
for v: variant in variants {
@@ -336,7 +334,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
336
334
ebml:: start_tag ( ebml_w, tag_items_data_item) ;
337
335
encode_def_id ( ebml_w, local_def ( ctor_id) ) ;
338
336
encode_family ( ebml_w, 'y' as u8 ) ;
339
- encode_type_param_kinds ( ebml_w, tps) ;
337
+ encode_type_param_bounds ( ebml_w, ecx , tps) ;
340
338
encode_type ( ecx, ebml_w, ty:: ty_fn_ret ( ecx. ccx . tcx , fn_ty) ) ;
341
339
encode_name ( ebml_w, item. ident ) ;
342
340
encode_symbol ( ecx, ebml_w, item. id ) ;
@@ -346,7 +344,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
346
344
ebml:: start_tag ( ebml_w, tag_items_data_item) ;
347
345
encode_def_id ( ebml_w, local_def ( ctor_id) ) ;
348
346
encode_family ( ebml_w, 'f' as u8 ) ;
349
- encode_type_param_kinds ( ebml_w, tps) ;
347
+ encode_type_param_bounds ( ebml_w, ecx , tps) ;
350
348
encode_type ( ecx, ebml_w, fn_ty) ;
351
349
encode_symbol ( ecx, ebml_w, ctor_id) ;
352
350
ebml:: end_tag ( ebml_w) ;
@@ -357,7 +355,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
357
355
ebml:: start_tag ( ebml_w, tag_items_data_item) ;
358
356
encode_def_id ( ebml_w, local_def ( item. id ) ) ;
359
357
encode_family ( ebml_w, 'y' as u8 ) ;
360
- encode_type_param_kinds ( ebml_w, tps) ;
358
+ encode_type_param_bounds ( ebml_w, ecx , tps) ;
361
359
encode_type ( ecx, ebml_w, ty:: ty_fn_ret ( ecx. ccx . tcx , fn_ty) ) ;
362
360
encode_name ( ebml_w, item. ident ) ;
363
361
ebml:: end_tag ( ebml_w) ;
@@ -366,7 +364,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
366
364
ebml:: start_tag ( ebml_w, tag_items_data_item) ;
367
365
encode_def_id ( ebml_w, local_def ( ctor_id) ) ;
368
366
encode_family ( ebml_w, 'f' as u8 ) ;
369
- encode_type_param_kinds ( ebml_w, tps) ;
367
+ encode_type_param_bounds ( ebml_w, ecx , tps) ;
370
368
encode_type ( ecx, ebml_w, fn_ty) ;
371
369
encode_symbol ( ecx, ebml_w, ctor_id) ;
372
370
ebml:: end_tag ( ebml_w) ;
@@ -375,7 +373,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
375
373
ebml:: start_tag ( ebml_w, tag_items_data_item) ;
376
374
encode_def_id ( ebml_w, local_def ( item. id ) ) ;
377
375
encode_family ( ebml_w, 'i' as u8 ) ;
378
- encode_type_param_kinds ( ebml_w, tps) ;
376
+ encode_type_param_bounds ( ebml_w, ecx , tps) ;
379
377
encode_type ( ecx, ebml_w, node_id_to_monotype ( ecx. ccx . tcx , item. id ) ) ;
380
378
encode_name ( ebml_w, item. ident ) ;
381
379
for m in methods {
@@ -390,7 +388,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
390
388
ebml:: start_tag ( ebml_w, tag_items_data_item) ;
391
389
encode_def_id ( ebml_w, local_def ( m. id ) ) ;
392
390
encode_family ( ebml_w, 'f' as u8 ) ;
393
- encode_type_param_kinds ( ebml_w, tps + m. tps ) ;
391
+ encode_type_param_bounds ( ebml_w, ecx , tps + m. tps ) ;
394
392
encode_type ( ecx, ebml_w,
395
393
node_id_to_monotype ( ecx. ccx . tcx , m. id ) ) ;
396
394
encode_name ( ebml_w, m. ident ) ;
@@ -421,7 +419,7 @@ fn encode_info_for_native_item(ecx: @encode_ctxt, ebml_w: ebml::writer,
421
419
} as u8 ;
422
420
encode_def_id ( ebml_w, local_def ( nitem. id ) ) ;
423
421
encode_family ( ebml_w, letter) ;
424
- encode_type_param_kinds ( ebml_w, tps) ;
422
+ encode_type_param_bounds ( ebml_w, ecx , tps) ;
425
423
encode_type ( ecx, ebml_w, node_id_to_monotype ( ecx. ccx . tcx , nitem. id ) ) ;
426
424
encode_symbol ( ecx, ebml_w, nitem. id ) ;
427
425
}
0 commit comments