@@ -1209,22 +1209,22 @@ fn simplify_type(&@crate_ctxt ccx, &ty::t typ) -> ty::t {
1209
1209
}
1210
1210
case ( ty:: ty_fn ( _, _, _, _, _) ) {
1211
1211
ret ty:: mk_imm_tup ( ccx. tcx ,
1212
- [ ty:: mk_imm_box ( ccx. tcx ,
1213
- ty:: mk_nil ( ccx. tcx ) ) ,
1214
- ty:: mk_imm_box ( ccx. tcx ,
1215
- ty:: mk_nil ( ccx. tcx ) ) ] ) ;
1212
+ ~ [ ty:: mk_imm_box ( ccx. tcx ,
1213
+ ty:: mk_nil ( ccx. tcx ) ) ,
1214
+ ty:: mk_imm_box ( ccx. tcx ,
1215
+ ty:: mk_nil ( ccx. tcx ) ) ] ) ;
1216
1216
}
1217
1217
case ( ty:: ty_obj ( _) ) {
1218
1218
ret ty:: mk_imm_tup ( ccx. tcx ,
1219
- [ ty:: mk_imm_box ( ccx. tcx ,
1220
- ty:: mk_nil ( ccx. tcx ) ) ,
1221
- ty:: mk_imm_box ( ccx. tcx ,
1222
- ty:: mk_nil ( ccx. tcx ) ) ] ) ;
1219
+ ~ [ ty:: mk_imm_box ( ccx. tcx ,
1220
+ ty:: mk_nil ( ccx. tcx ) ) ,
1221
+ ty:: mk_imm_box ( ccx. tcx ,
1222
+ ty:: mk_nil ( ccx. tcx ) ) ] ) ;
1223
1223
}
1224
1224
case ( ty:: ty_res ( _, ?sub, ?tps) ) {
1225
1225
auto sub1 = ty:: substitute_type_params ( ccx. tcx , tps, sub) ;
1226
- ret ty:: mk_imm_tup ( ccx. tcx , [ ty:: mk_int ( ccx. tcx ) ,
1227
- simplify_type ( ccx, sub1) ] ) ;
1226
+ ret ty:: mk_imm_tup ( ccx. tcx , ~ [ ty:: mk_int ( ccx. tcx ) ,
1227
+ simplify_type ( ccx, sub1) ] ) ;
1228
1228
}
1229
1229
case ( _) { ret typ; }
1230
1230
}
@@ -1256,7 +1256,11 @@ fn static_size_of_tag(&@crate_ctxt cx, &span sp, &ty::t t) -> uint {
1256
1256
auto max_size = 0 u;
1257
1257
auto variants = ty:: tag_variants ( cx. tcx , tid) ;
1258
1258
for ( ty:: variant_info variant in variants) {
1259
- auto tup_ty = simplify_type( cx, ty:: mk_imm_tup( cx. tcx, variant. args) ) ;
1259
+ // TODO: Remove this vec->ivec conversion.
1260
+ auto args = ~[ ] ;
1261
+ for ( ty:: t typ in variant. args) { args += ~[ typ] ; }
1262
+
1263
+ auto tup_ty = simplify_type( cx, ty:: mk_imm_tup( cx. tcx, args) ) ;
1260
1264
// Perform any type parameter substitutions.
1261
1265
1262
1266
tup_ty = ty:: substitute_type_params( cx. tcx, subtys, tup_ty) ;
@@ -1469,7 +1473,11 @@ fn GEP_tup_like(&@block_ctxt cx, &ty::t t, ValueRef base, &vec[int] ixs) ->
1469
1473
// flattened the incoming structure.
1470
1474
1471
1475
auto s = split_type ( cx. fcx . lcx . ccx , t, ixs, 0 u) ;
1472
- auto prefix_ty = ty:: mk_imm_tup ( cx. fcx . lcx . ccx . tcx , s. prefix ) ;
1476
+
1477
+ auto args = ~[ ] ;
1478
+ for ( ty:: t typ in s. prefix) { args += ~[ typ] ; }
1479
+ auto prefix_ty = ty:: mk_imm_tup ( cx. fcx . lcx . ccx . tcx , args) ;
1480
+
1473
1481
auto bcx = cx;
1474
1482
auto sz = size_of ( bcx, prefix_ty) ;
1475
1483
bcx = sz. bcx ;
@@ -1498,11 +1506,11 @@ fn GEP_tag(@block_ctxt cx, ValueRef llblobptr, &ast::def_id tag_id,
1498
1506
auto elem_ty = ty:: mk_nil ( cx. fcx . lcx . ccx . tcx ) ; // typestate infelicity
1499
1507
1500
1508
auto i = 0 ;
1501
- let vec [ ty:: t] true_arg_tys = [ ] ;
1509
+ let ty:: t[ ] true_arg_tys = ~ [ ] ;
1502
1510
for ( ty:: t aty in arg_tys) {
1503
1511
auto arg_ty =
1504
1512
ty:: substitute_type_params( cx. fcx. lcx. ccx. tcx, ty_substs, aty) ;
1505
- true_arg_tys += [ arg_ty] ;
1513
+ true_arg_tys += ~ [ arg_ty] ;
1506
1514
if ( i == ix) { elem_ty = arg_ty; }
1507
1515
i += 1 ;
1508
1516
}
@@ -1559,7 +1567,7 @@ fn trans_malloc_boxed(&@block_ctxt cx, ty::t t) -> result {
1559
1567
ty:: mk_imm_tup ( cx. fcx . lcx . ccx . tcx ,
1560
1568
// The mk_int here is the space being
1561
1569
// reserved for the refcount.
1562
- [ ty:: mk_int ( cx. fcx . lcx . ccx . tcx ) , t] ) ;
1570
+ ~ [ ty:: mk_int ( cx. fcx . lcx . ccx . tcx ) , t] ) ;
1563
1571
auto box_ptr = ty:: mk_imm_box ( cx. fcx . lcx . ccx . tcx , t) ;
1564
1572
auto sz = size_of ( cx, boxed_body) ;
1565
1573
// Grab the TypeRef type of box_ptr, because that's what trans_raw_malloc
@@ -2111,9 +2119,8 @@ fn make_drop_glue(&@block_ctxt cx, ValueRef v0, &ty::t t) {
2111
2119
fn trans_res_drop( @block_ctxt cx, ValueRef rs, & ast:: def_id did,
2112
2120
ty:: t inner_t, & vec[ ty:: t] tps) -> result {
2113
2121
auto ccx = cx. fcx. lcx. ccx;
2114
-
2115
2122
auto inner_t_s = ty:: substitute_type_params( ccx. tcx, tps, inner_t) ;
2116
- auto tup_ty = ty:: mk_imm_tup( ccx. tcx, [ ty:: mk_int( ccx. tcx) , inner_t_s] ) ;
2123
+ auto tup_ty = ty:: mk_imm_tup( ccx. tcx, ~ [ ty:: mk_int( ccx. tcx) , inner_t_s] ) ;
2117
2124
auto drop_cx = new_sub_block_ctxt( cx, "drop res") ;
2118
2125
auto next_cx = new_sub_block_ctxt( cx, "next") ;
2119
2126
@@ -5343,17 +5350,21 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
5343
5350
auto arg = trans_expr( bcx, e) ;
5344
5351
bcx = arg. bcx;
5345
5352
vec:: push[ ValueRef ] ( bound_vals, arg. val) ;
5346
- vec:: push[ ty:: t] ( bound_tys,
5347
- ty:: expr_ty( cx. fcx. lcx. ccx. tcx, e) ) ;
5353
+ bound_tys += [ ty:: expr_ty( cx. fcx. lcx. ccx. tcx, e) ] ;
5348
5354
}
5349
5355
5350
5356
// Synthesize a closure type.
5351
5357
5352
5358
// First, synthesize a tuple type containing the types of all the
5353
5359
// bound expressions.
5354
5360
// bindings_ty = [bound_ty1, bound_ty2, ...]
5361
+
5362
+ // TODO: Remove this vec->ivec conversion.
5363
+ auto bound_tys_ivec = ~[ ] ;
5364
+ for ( ty:: t typ in bound_tys) { bound_tys_ivec += ~[ typ] ; }
5365
+
5355
5366
let ty:: t bindings_ty =
5356
- ty:: mk_imm_tup( cx. fcx. lcx. ccx. tcx, bound_tys ) ;
5367
+ ty:: mk_imm_tup( cx. fcx. lcx. ccx. tcx, bound_tys_ivec ) ;
5357
5368
5358
5369
// NB: keep this in sync with T_closure_ptr; we're making
5359
5370
// a ty::t structure that has the same "shape" as the LLVM type
@@ -5362,18 +5373,18 @@ fn trans_bind(&@block_ctxt cx, &@ast::expr f,
5362
5373
// Make a vector that contains ty_param_count copies of tydesc_ty.
5363
5374
// (We'll need room for that many tydescs in the closure.)
5364
5375
let ty:: t tydesc_ty = ty:: mk_type( cx. fcx. lcx. ccx. tcx) ;
5365
- let vec [ ty:: t] captured_tys =
5366
- vec :: init_elt[ ty:: t] ( tydesc_ty, ty_param_count) ;
5376
+ let ty:: t[ ] captured_tys =
5377
+ std :: ivec :: init_elt[ ty:: t] ( tydesc_ty, ty_param_count) ;
5367
5378
5368
5379
// Get all the types we've got (some of which we synthesized
5369
5380
// ourselves) into a vector. The whole things ends up looking
5370
5381
// like:
5371
5382
5372
5383
// closure_tys = [tydesc_ty, outgoing_fty, [bound_ty1, bound_ty2,
5373
5384
// ...], [tydesc_ty, tydesc_ty, ...]]
5374
- let vec [ ty:: t] closure_tys =
5375
- [ tydesc_ty, outgoing_fty, bindings_ty,
5376
- ty:: mk_imm_tup( cx. fcx. lcx. ccx. tcx, captured_tys) ] ;
5385
+ let ty:: t[ ] closure_tys =
5386
+ ~ [ tydesc_ty, outgoing_fty, bindings_ty,
5387
+ ty:: mk_imm_tup( cx. fcx. lcx. ccx. tcx, captured_tys) ] ;
5377
5388
5378
5389
// Finally, synthesize a type for that whole vector.
5379
5390
let ty:: t closure_ty =
@@ -5745,8 +5756,7 @@ fn trans_vec(&@block_ctxt cx, &vec[@ast::expr] args, ast::node_id id) ->
5745
5756
auto body = bcx. build. GEP ( vec_val, [ C_int ( 0 ) , C_int ( abi:: vec_elt_data) ] ) ;
5746
5757
auto pseudo_tup_ty =
5747
5758
ty:: mk_imm_tup( cx. fcx. lcx. ccx. tcx,
5748
- vec:: init_elt[ ty:: t] ( unit_ty,
5749
- vec:: len[ @ast:: expr] ( args) ) ) ;
5759
+ std:: ivec:: init_elt[ ty:: t] ( unit_ty, vec:: len( args) ) ) ;
5750
5760
let int i = 0 ;
5751
5761
for ( @ast:: expr e in args) {
5752
5762
auto src_res = trans_expr( bcx, e) ;
@@ -6524,7 +6534,7 @@ fn trans_spawn(&@block_ctxt cx, &ast::spawn_dom dom, &option::t[str] name,
6524
6534
// Translate the arguments, remembering their types and where the values
6525
6535
// ended up.
6526
6536
6527
- let vec [ ty:: t] arg_tys = [ ] ;
6537
+ let ty:: t[ ] arg_tys = ~ [ ] ;
6528
6538
let vec[ ValueRef ] arg_vals = [ ] ;
6529
6539
for ( @ast:: expr e in args) {
6530
6540
auto e_ty = ty:: expr_ty( cx. fcx. lcx. ccx. tcx, e) ;
@@ -6535,7 +6545,7 @@ fn trans_spawn(&@block_ctxt cx, &ast::spawn_dom dom, &option::t[str] name,
6535
6545
bcx = arg. bcx;
6536
6546
6537
6547
vec:: push[ ValueRef ] ( arg_vals, arg. val) ;
6538
- vec :: push [ ty :: t ] ( arg_tys, e_ty) ;
6548
+ arg_tys += ~ [ e_ty] ;
6539
6549
}
6540
6550
// Make the tuple.
6541
6551
@@ -6785,13 +6795,13 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
6785
6795
// the outer object?
6786
6796
let vec[ ast:: anon_obj_field] additional_fields = [ ] ;
6787
6797
let vec[ result] additional_field_vals = [ ] ;
6788
- let vec [ ty:: t] additional_field_tys = [ ] ;
6798
+ let ty:: t[ ] additional_field_tys = ~ [ ] ;
6789
6799
alt ( anon_obj. fields) {
6790
6800
case ( none) { }
6791
6801
case ( some( ?fields) ) {
6792
6802
additional_fields = fields;
6793
6803
for ( ast:: anon_obj_field f in fields) {
6794
- additional_field_tys += [ node_id_type( ccx, f. id) ] ;
6804
+ additional_field_tys += ~ [ node_id_type( ccx, f. id) ] ;
6795
6805
additional_field_vals += [ trans_expr( bcx, f. expr) ] ;
6796
6806
}
6797
6807
}
@@ -6895,18 +6905,18 @@ fn trans_anon_obj(@block_ctxt bcx, &span sp, &ast::anon_obj anon_obj,
6895
6905
// actually supporting typarams for anon objs yet, but let's
6896
6906
// create space for them in case we ever want them.
6897
6907
let ty:: t tydesc_ty = ty:: mk_type( ccx. tcx) ;
6898
- let vec [ ty:: t] tps = [ ] ;
6908
+ let ty:: t[ ] tps = ~ [ ] ;
6899
6909
for ( ast:: ty_param tp in ty_params) {
6900
- vec :: push [ ty :: t ] ( tps, tydesc_ty) ;
6910
+ tps += ~ [ tydesc_ty] ;
6901
6911
}
6902
6912
// Synthesize a tuple type for typarams: [typaram, ...]
6903
6913
let ty:: t typarams_ty = ty:: mk_imm_tup( ccx. tcx, tps) ;
6904
6914
6905
6915
// Tuple type for body:
6906
6916
// [tydesc_ty, [typaram, ...], [field, ...], with_obj]
6907
6917
let ty:: t body_ty =
6908
- ty:: mk_imm_tup( ccx. tcx, [ tydesc_ty, typarams_ty,
6909
- fields_ty, with_obj_ty] ) ;
6918
+ ty:: mk_imm_tup( ccx. tcx, ~ [ tydesc_ty, typarams_ty,
6919
+ fields_ty, with_obj_ty] ) ;
6910
6920
6911
6921
// Hand this type we've synthesized off to trans_malloc_boxed, which
6912
6922
// allocates a box, including space for a refcount.
@@ -7498,9 +7508,9 @@ fn arg_tys_of_fn(&@crate_ctxt ccx,ast::node_id id) -> vec[ty::arg] {
7498
7508
7499
7509
fn populate_fn_ctxt_from_llself( @fn_ctxt fcx, val_self_pair llself) {
7500
7510
auto bcx = llstaticallocas_block_ctxt( fcx) ;
7501
- let vec [ ty:: t] field_tys = [ ] ;
7511
+ let ty:: t[ ] field_tys = ~ [ ] ;
7502
7512
for ( ast:: obj_field f in bcx. fcx. lcx. obj_fields) {
7503
- field_tys += [ node_id_type( bcx. fcx. lcx. ccx, f. id) ] ;
7513
+ field_tys += ~ [ node_id_type( bcx. fcx. lcx. ccx, f. id) ] ;
7504
7514
}
7505
7515
// Synthesize a tuple type for the fields so that GEP_tup_like() can work
7506
7516
// its magic.
@@ -7761,24 +7771,22 @@ fn trans_obj(@local_ctxt cx, &span sp, &ast::_obj ob, ast::node_id ctor_id,
7761
7771
} else {
7762
7772
// Otherwise, we have to synthesize a big structural type for the
7763
7773
// object body.
7764
- let vec [ ty:: t] obj_fields = [ ] ;
7765
- for ( ty:: arg a in arg_tys) { vec :: push [ ty :: t ] ( obj_fields, a. ty) ; }
7774
+ let ty:: t[ ] obj_fields = ~ [ ] ;
7775
+ for ( ty:: arg a in arg_tys) { obj_fields += ~ [ a. ty] ; }
7766
7776
7767
7777
// Tuple type for fields: [field, ...]
7768
7778
let ty:: t fields_ty = ty:: mk_imm_tup( ccx. tcx, obj_fields) ;
7769
7779
7770
7780
auto tydesc_ty = ty:: mk_type( ccx. tcx) ;
7771
- let vec[ ty:: t] tps = [ ] ;
7772
- for ( ast:: ty_param tp in ty_params) {
7773
- vec:: push[ ty:: t] ( tps, tydesc_ty) ;
7774
- }
7781
+ let ty:: t[ ] tps = ~[ ] ;
7782
+ for ( ast:: ty_param tp in ty_params) { tps += ~[ tydesc_ty] ; }
7775
7783
7776
7784
// Tuple type for typarams: [typaram, ...]
7777
7785
let ty:: t typarams_ty = ty:: mk_imm_tup( ccx. tcx, tps) ;
7778
7786
7779
7787
// Tuple type for body: [tydesc_ty, [typaram, ...], [field, ...]]
7780
7788
let ty:: t body_ty =
7781
- ty:: mk_imm_tup( ccx. tcx, [ tydesc_ty, typarams_ty, fields_ty] ) ;
7789
+ ty:: mk_imm_tup( ccx. tcx, ~ [ tydesc_ty, typarams_ty, fields_ty] ) ;
7782
7790
7783
7791
// Hand this type we've synthesized off to trans_malloc_boxed, which
7784
7792
// allocates a box, including space for a refcount.
@@ -7879,7 +7887,7 @@ fn trans_res_ctor(@local_ctxt cx, &span sp, &ast::_fn dtor,
7879
7887
auto bcx = new_top_block_ctxt( fcx) ;
7880
7888
auto lltop = bcx. llbb;
7881
7889
auto arg_t = arg_tys_of_fn( cx. ccx, ctor_id) . ( 0 ) . ty;
7882
- auto tup_t = ty:: mk_imm_tup( cx. ccx. tcx, [ ty:: mk_int( cx. ccx. tcx) , arg_t] ) ;
7890
+ auto tup_t = ty:: mk_imm_tup( cx. ccx. tcx, ~ [ ty:: mk_int( cx. ccx. tcx) , arg_t] ) ;
7883
7891
auto arg = load_if_immediate
7884
7892
( bcx, fcx. llargs. get( dtor. decl. inputs. ( 0 ) . id) , arg_t) ;
7885
7893
0 commit comments