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