Skip to content

Commit 8f33d3d

Browse files
committed
issue #1352: change param order on vec::init_elt, putting block in final position.
To match the init_fn() and init_fn_mut() changes.
1 parent fc95249 commit 8f33d3d

File tree

27 files changed

+56
-56
lines changed

27 files changed

+56
-56
lines changed

src/comp/lib/llvm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
972972
let s = "fn(";
973973
let out_ty: TypeRef = llvm::LLVMGetReturnType(ty);
974974
let n_args = llvm::LLVMCountParamTypes(ty) as uint;
975-
let args: [TypeRef] = vec::init_elt::<TypeRef>(0 as TypeRef, n_args);
975+
let args: [TypeRef] = vec::init_elt::<TypeRef>(n_args, 0 as TypeRef);
976976
unsafe {
977977
llvm::LLVMGetParamTypes(ty, vec::to_ptr(args));
978978
}
@@ -984,7 +984,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
984984
10 {
985985
let s: str = "{";
986986
let n_elts = llvm::LLVMCountStructElementTypes(ty) as uint;
987-
let elts: [TypeRef] = vec::init_elt::<TypeRef>(0 as TypeRef, n_elts);
987+
let elts: [TypeRef] = vec::init_elt::<TypeRef>(n_elts, 0 as TypeRef);
988988
unsafe {
989989
llvm::LLVMGetStructElementTypes(ty, vec::to_ptr(elts));
990990
}
@@ -1027,8 +1027,8 @@ fn float_width(llt: TypeRef) -> uint {
10271027
}
10281028

10291029
fn fn_ty_param_tys(fn_ty: TypeRef) -> [TypeRef] unsafe {
1030-
let args = vec::init_elt(0 as TypeRef,
1031-
llvm::LLVMCountParamTypes(fn_ty) as uint);
1030+
let args = vec::init_elt(llvm::LLVMCountParamTypes(fn_ty) as uint,
1031+
0 as TypeRef);
10321032
llvm::LLVMGetParamTypes(fn_ty, vec::to_ptr(args));
10331033
ret args;
10341034
}

src/comp/middle/trans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ fn get_simple_extern_fn(cx: @block_ctxt,
338338
llmod: ModuleRef,
339339
name: str, n_args: int) -> ValueRef {
340340
let ccx = cx.fcx.lcx.ccx;
341-
let inputs = vec::init_elt::<TypeRef>(ccx.int_type, n_args as uint);
341+
let inputs = vec::init_elt::<TypeRef>(n_args as uint, ccx.int_type);
342342
let output = ccx.int_type;
343343
let t = T_fn(inputs, output);
344344
ret get_extern_fn(externs, llmod, name,
@@ -2869,7 +2869,7 @@ fn lval_maybe_callee_to_lval(c: lval_maybe_callee, ty: ty::t) -> lval_result {
28692869
alt c.generic {
28702870
some(gi) {
28712871
let n_args = vec::len(ty::ty_fn_args(bcx_tcx(c.bcx), ty));
2872-
let args = vec::init_elt(none::<@ast::expr>, n_args);
2872+
let args = vec::init_elt(n_args, none::<@ast::expr>);
28732873
let space = alloc_ty(c.bcx, ty);
28742874
let bcx = trans_closure::trans_bind_1(space.bcx, ty, c, args, ty,
28752875
save_in(space.val));

src/comp/middle/trans_alt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ fn enter_opt(ccx: @crate_ctxt, m: match, opt: opt, col: uint, tag_size: uint,
174174
ast::pat_range(l1, l2) {
175175
ret if opt_eq(range(l1, l2), opt) { some([]) } else { none };
176176
}
177-
_ { ret some(vec::init_elt(dummy, size)); }
177+
_ { ret some(vec::init_elt(size, dummy)); }
178178
}
179179
}
180180
ret enter_match(m, col, val, bind e(ccx, dummy, opt, tag_size, _));
@@ -197,7 +197,7 @@ fn enter_rec(m: match, col: uint, fields: [ast::ident], val: ValueRef) ->
197197
}
198198
ret some(pats);
199199
}
200-
_ { ret some(vec::init_elt(dummy, vec::len(fields))); }
200+
_ { ret some(vec::init_elt(vec::len(fields), dummy)); }
201201
}
202202
}
203203
ret enter_match(m, col, val, bind e(dummy, fields, _));
@@ -209,7 +209,7 @@ fn enter_tup(m: match, col: uint, val: ValueRef, n_elts: uint) -> match {
209209
option::t<[@ast::pat]> {
210210
alt p.node {
211211
ast::pat_tup(elts) { ret some(elts); }
212-
_ { ret some(vec::init_elt(dummy, n_elts)); }
212+
_ { ret some(vec::init_elt(n_elts, dummy)); }
213213
}
214214
}
215215
ret enter_match(m, col, val, bind e(dummy, n_elts, _));
@@ -343,7 +343,7 @@ fn pick_col(m: match) -> uint {
343343
_ { 0u }
344344
}
345345
}
346-
let scores = vec::init_elt_mut(0u, vec::len(m[0].pats));
346+
let scores = vec::init_elt_mut(vec::len(m[0].pats), 0u);
347347
for br: match_branch in m {
348348
let i = 0u;
349349
for p: @ast::pat in br.pats { scores[i] += score(p); i += 1u; }

src/comp/middle/trans_common.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ fn val_str(tn: type_names, v: ValueRef) -> str { ret ty_str(tn, val_ty(v)); }
413413
fn struct_elt(llstructty: TypeRef, n: uint) -> TypeRef unsafe {
414414
let elt_count = llvm::LLVMCountStructElementTypes(llstructty) as uint;
415415
assert (n < elt_count);
416-
let elt_tys = vec::init_elt(T_nil(), elt_count);
416+
let elt_tys = vec::init_elt(elt_count, T_nil());
417417
llvm::LLVMGetStructElementTypes(llstructty, to_ptr(elt_tys));
418418
ret llvm::LLVMGetElementType(elt_tys[n]);
419419
}
@@ -594,8 +594,8 @@ fn T_tydesc_field(cx: @crate_ctxt, field: int) -> TypeRef unsafe {
594594
// Bit of a kludge: pick the fn typeref out of the tydesc..
595595

596596
let tydesc_elts: [TypeRef] =
597-
vec::init_elt::<TypeRef>(T_nil(),
598-
abi::n_tydesc_fields as uint);
597+
vec::init_elt::<TypeRef>(abi::n_tydesc_fields as uint,
598+
T_nil());
599599
llvm::LLVMGetStructElementTypes(cx.tydesc_type,
600600
to_ptr::<TypeRef>(tydesc_elts));
601601
let t = llvm::LLVMGetElementType(tydesc_elts[field]);
@@ -729,7 +729,7 @@ fn T_opaque_tag_ptr(cx: @crate_ctxt) -> TypeRef {
729729
}
730730

731731
fn T_captured_tydescs(cx: @crate_ctxt, n: uint) -> TypeRef {
732-
ret T_struct(vec::init_elt::<TypeRef>(T_ptr(cx.tydesc_type), n));
732+
ret T_struct(vec::init_elt::<TypeRef>(n, T_ptr(cx.tydesc_type)));
733733
}
734734

735735
fn T_opaque_iface_ptr(cx: @crate_ctxt) -> TypeRef {

src/comp/middle/trans_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ fn trans_iface_callee(bcx: @block_ctxt, fld_expr: @ast::expr,
139139
fn llfn_arg_tys(ft: TypeRef) -> {inputs: [TypeRef], output: TypeRef} {
140140
let out_ty = llvm::LLVMGetReturnType(ft);
141141
let n_args = llvm::LLVMCountParamTypes(ft);
142-
let args = vec::init_elt(0 as TypeRef, n_args as uint);
142+
let args = vec::init_elt(n_args as uint, 0 as TypeRef);
143143
unsafe { llvm::LLVMGetParamTypes(ft, vec::to_ptr(args)); }
144144
{inputs: args, output: out_ty}
145145
}

src/comp/middle/tstate/states.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
343343
alt e.node {
344344
expr_vec(elts, _) {
345345
ret find_pre_post_state_exprs(fcx, pres, e.id,
346-
vec::init_elt(init_assign,
347-
vec::len(elts)), elts,
346+
vec::init_elt(vec::len(elts),
347+
init_assign), elts,
348348
return_val);
349349
}
350350
expr_call(operator, operands, _) {
@@ -386,8 +386,8 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
386386
expr_rec(fields, maybe_base) {
387387
let changed =
388388
find_pre_post_state_exprs(fcx, pres, e.id,
389-
vec::init_elt(init_assign,
390-
vec::len(fields)),
389+
vec::init_elt(vec::len(fields),
390+
init_assign),
391391
field_exprs(fields), return_val);
392392
alt maybe_base {
393393
none. {/* do nothing */ }
@@ -402,8 +402,8 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
402402
}
403403
expr_tup(elts) {
404404
ret find_pre_post_state_exprs(fcx, pres, e.id,
405-
vec::init_elt(init_assign,
406-
vec::len(elts)), elts,
405+
vec::init_elt(vec::len(elts),
406+
init_assign), elts,
407407
return_val);
408408
}
409409
expr_copy(a) { ret find_pre_post_state_sub(fcx, pres, a, e.id, none); }

src/comp/middle/typeck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
16501650
// HACK: build an arguments list with dummy arguments to
16511651
// check against
16521652
let dummy = {mode: ast::by_ref, ty: ty::mk_bot(fcx.ccx.tcx)};
1653-
arg_tys = vec::init_elt(dummy, supplied_arg_count);
1653+
arg_tys = vec::init_elt(supplied_arg_count, dummy);
16541654
}
16551655

16561656
// Check the arguments.

src/comp/syntax/print/pp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ fn mk_printer(out: io::writer, linewidth: uint) -> printer {
102102
// fall behind.
103103
let n: uint = 3u * linewidth;
104104
#debug("mk_printer %u", linewidth);
105-
let token: [mutable token] = vec::init_elt_mut(EOF, n);
106-
let size: [mutable int] = vec::init_elt_mut(0, n);
107-
let scan_stack: [mutable uint] = vec::init_elt_mut(0u, n);
105+
let token: [mutable token] = vec::init_elt_mut(n, EOF);
106+
let size: [mutable int] = vec::init_elt_mut(n, 0);
107+
let scan_stack: [mutable uint] = vec::init_elt_mut(n, 0u);
108108
let print_stack: [print_stack_elt] = [];
109109
@{out: out,
110110
buf_len: n,

src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ fn check_expected_errors(expected_errors: [errors::expected_error],
231231
procres: procres) {
232232

233233
// true if we found the error in question
234-
let found_flags = vec::init_elt_mut(false, vec::len(expected_errors));
234+
let found_flags = vec::init_elt_mut(vec::len(expected_errors), false);
235235

236236
if procres.status == 0 {
237237
fatal("process did not return an error status");

src/libcore/extfmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ mod rt {
387387

388388
// FIXME: This might be useful in str: but needs to be utf8 safe first
389389
fn str_init_elt(c: char, n_elts: uint) -> str {
390-
let svec = vec::init_elt::<u8>(c as u8, n_elts);
390+
let svec = vec::init_elt::<u8>(n_elts, c as u8);
391391

392392
ret str::unsafe_from_bytes(svec);
393393
}

0 commit comments

Comments
 (0)