issue #1352: change param order on vec::init_elt, putting block in final position.
To match the init_fn() and init_fn_mut() changes.
This commit is contained in:
parent
35d12be2ce
commit
7763b40c71
@ -972,7 +972,7 @@ fn tys_str(names: type_names, outer: [TypeRef], tys: [TypeRef]) -> str {
|
||||
let s = "fn(";
|
||||
let out_ty: TypeRef = llvm::LLVMGetReturnType(ty);
|
||||
let n_args = llvm::LLVMCountParamTypes(ty) as uint;
|
||||
let args: [TypeRef] = vec::init_elt::<TypeRef>(0 as TypeRef, n_args);
|
||||
let args: [TypeRef] = vec::init_elt::<TypeRef>(n_args, 0 as TypeRef);
|
||||
unsafe {
|
||||
llvm::LLVMGetParamTypes(ty, vec::to_ptr(args));
|
||||
}
|
||||
@ -984,7 +984,7 @@ fn tys_str(names: type_names, outer: [TypeRef], tys: [TypeRef]) -> str {
|
||||
10 {
|
||||
let s: str = "{";
|
||||
let n_elts = llvm::LLVMCountStructElementTypes(ty) as uint;
|
||||
let elts: [TypeRef] = vec::init_elt::<TypeRef>(0 as TypeRef, n_elts);
|
||||
let elts: [TypeRef] = vec::init_elt::<TypeRef>(n_elts, 0 as TypeRef);
|
||||
unsafe {
|
||||
llvm::LLVMGetStructElementTypes(ty, vec::to_ptr(elts));
|
||||
}
|
||||
@ -1027,8 +1027,8 @@ fn float_width(llt: TypeRef) -> uint {
|
||||
}
|
||||
|
||||
fn fn_ty_param_tys(fn_ty: TypeRef) -> [TypeRef] unsafe {
|
||||
let args = vec::init_elt(0 as TypeRef,
|
||||
llvm::LLVMCountParamTypes(fn_ty) as uint);
|
||||
let args = vec::init_elt(llvm::LLVMCountParamTypes(fn_ty) as uint,
|
||||
0 as TypeRef);
|
||||
llvm::LLVMGetParamTypes(fn_ty, vec::to_ptr(args));
|
||||
ret args;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ fn get_simple_extern_fn(cx: @block_ctxt,
|
||||
llmod: ModuleRef,
|
||||
name: str, n_args: int) -> ValueRef {
|
||||
let ccx = cx.fcx.lcx.ccx;
|
||||
let inputs = vec::init_elt::<TypeRef>(ccx.int_type, n_args as uint);
|
||||
let inputs = vec::init_elt::<TypeRef>(n_args as uint, ccx.int_type);
|
||||
let output = ccx.int_type;
|
||||
let t = T_fn(inputs, output);
|
||||
ret get_extern_fn(externs, llmod, name,
|
||||
@ -2842,7 +2842,7 @@ fn lval_maybe_callee_to_lval(c: lval_maybe_callee, ty: ty::t) -> lval_result {
|
||||
alt c.generic {
|
||||
some(gi) {
|
||||
let n_args = vec::len(ty::ty_fn_args(bcx_tcx(c.bcx), ty));
|
||||
let args = vec::init_elt(none::<@ast::expr>, n_args);
|
||||
let args = vec::init_elt(n_args, none::<@ast::expr>);
|
||||
let space = alloc_ty(c.bcx, ty);
|
||||
let bcx = trans_closure::trans_bind_1(space.bcx, ty, c, args, ty,
|
||||
save_in(space.val));
|
||||
|
@ -175,7 +175,7 @@ fn e(ccx: @crate_ctxt, dummy: @ast::pat, opt: opt, size: uint,
|
||||
ast::pat_range(l1, l2) {
|
||||
ret if opt_eq(range(l1, l2), opt) { some([]) } else { none };
|
||||
}
|
||||
_ { ret some(vec::init_elt(dummy, size)); }
|
||||
_ { ret some(vec::init_elt(size, dummy)); }
|
||||
}
|
||||
}
|
||||
ret enter_match(m, col, val, bind e(ccx, dummy, opt, tag_size, _));
|
||||
@ -198,7 +198,7 @@ fn e(dummy: @ast::pat, fields: [ast::ident], p: @ast::pat) ->
|
||||
}
|
||||
ret some(pats);
|
||||
}
|
||||
_ { ret some(vec::init_elt(dummy, vec::len(fields))); }
|
||||
_ { ret some(vec::init_elt(vec::len(fields), dummy)); }
|
||||
}
|
||||
}
|
||||
ret enter_match(m, col, val, bind e(dummy, fields, _));
|
||||
@ -210,7 +210,7 @@ fn e(dummy: @ast::pat, n_elts: uint, p: @ast::pat) ->
|
||||
option::t<[@ast::pat]> {
|
||||
alt p.node {
|
||||
ast::pat_tup(elts) { ret some(elts); }
|
||||
_ { ret some(vec::init_elt(dummy, n_elts)); }
|
||||
_ { ret some(vec::init_elt(n_elts, dummy)); }
|
||||
}
|
||||
}
|
||||
ret enter_match(m, col, val, bind e(dummy, n_elts, _));
|
||||
@ -344,7 +344,7 @@ fn score(p: @ast::pat) -> uint {
|
||||
_ { 0u }
|
||||
}
|
||||
}
|
||||
let scores = vec::init_elt_mut(0u, vec::len(m[0].pats));
|
||||
let scores = vec::init_elt_mut(vec::len(m[0].pats), 0u);
|
||||
for br: match_branch in m {
|
||||
let i = 0u;
|
||||
for p: @ast::pat in br.pats { scores[i] += score(p); i += 1u; }
|
||||
|
@ -413,7 +413,7 @@ fn ty_str(tn: type_names, t: TypeRef) -> str {
|
||||
fn struct_elt(llstructty: TypeRef, n: uint) -> TypeRef unsafe {
|
||||
let elt_count = llvm::LLVMCountStructElementTypes(llstructty) as uint;
|
||||
assert (n < elt_count);
|
||||
let elt_tys = vec::init_elt(T_nil(), elt_count);
|
||||
let elt_tys = vec::init_elt(elt_count, T_nil());
|
||||
llvm::LLVMGetStructElementTypes(llstructty, to_ptr(elt_tys));
|
||||
ret llvm::LLVMGetElementType(elt_tys[n]);
|
||||
}
|
||||
@ -594,8 +594,8 @@ fn T_tydesc_field(cx: @crate_ctxt, field: int) -> TypeRef unsafe {
|
||||
// Bit of a kludge: pick the fn typeref out of the tydesc..
|
||||
|
||||
let tydesc_elts: [TypeRef] =
|
||||
vec::init_elt::<TypeRef>(T_nil(),
|
||||
abi::n_tydesc_fields as uint);
|
||||
vec::init_elt::<TypeRef>(abi::n_tydesc_fields as uint,
|
||||
T_nil());
|
||||
llvm::LLVMGetStructElementTypes(cx.tydesc_type,
|
||||
to_ptr::<TypeRef>(tydesc_elts));
|
||||
let t = llvm::LLVMGetElementType(tydesc_elts[field]);
|
||||
@ -729,7 +729,7 @@ fn T_opaque_tag_ptr(cx: @crate_ctxt) -> TypeRef {
|
||||
}
|
||||
|
||||
fn T_captured_tydescs(cx: @crate_ctxt, n: uint) -> TypeRef {
|
||||
ret T_struct(vec::init_elt::<TypeRef>(T_ptr(cx.tydesc_type), n));
|
||||
ret T_struct(vec::init_elt::<TypeRef>(n, T_ptr(cx.tydesc_type)));
|
||||
}
|
||||
|
||||
fn T_opaque_iface_ptr(cx: @crate_ctxt) -> TypeRef {
|
||||
|
@ -139,7 +139,7 @@ fn trans_iface_callee(bcx: @block_ctxt, fld_expr: @ast::expr,
|
||||
fn llfn_arg_tys(ft: TypeRef) -> {inputs: [TypeRef], output: TypeRef} {
|
||||
let out_ty = llvm::LLVMGetReturnType(ft);
|
||||
let n_args = llvm::LLVMCountParamTypes(ft);
|
||||
let args = vec::init_elt(0 as TypeRef, n_args as uint);
|
||||
let args = vec::init_elt(n_args as uint, 0 as TypeRef);
|
||||
unsafe { llvm::LLVMGetParamTypes(ft, vec::to_ptr(args)); }
|
||||
{inputs: args, output: out_ty}
|
||||
}
|
||||
|
@ -360,8 +360,8 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
|
||||
alt e.node {
|
||||
expr_vec(elts, _) {
|
||||
ret find_pre_post_state_exprs(fcx, pres, e.id,
|
||||
vec::init_elt(init_assign,
|
||||
vec::len(elts)), elts,
|
||||
vec::init_elt(vec::len(elts),
|
||||
init_assign), elts,
|
||||
return_val);
|
||||
}
|
||||
expr_call(operator, operands, _) {
|
||||
@ -404,8 +404,8 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
|
||||
let exs = field_exprs(fields);
|
||||
let changed =
|
||||
find_pre_post_state_exprs(fcx, pres, e.id,
|
||||
vec::init_elt(init_assign,
|
||||
vec::len(fields)),
|
||||
vec::init_elt(vec::len(fields),
|
||||
init_assign),
|
||||
exs, return_val);
|
||||
|
||||
let base_pres = alt vec::last(exs) { none { pres }
|
||||
@ -418,8 +418,8 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
|
||||
}
|
||||
expr_tup(elts) {
|
||||
ret find_pre_post_state_exprs(fcx, pres, e.id,
|
||||
vec::init_elt(init_assign,
|
||||
vec::len(elts)), elts,
|
||||
vec::init_elt(vec::len(elts),
|
||||
init_assign), elts,
|
||||
return_val);
|
||||
}
|
||||
expr_copy(a) { ret find_pre_post_state_sub(fcx, pres, a, e.id, none); }
|
||||
|
@ -1650,7 +1650,7 @@ fn check_call_or_bind(fcx: @fn_ctxt, sp: span, f: @ast::expr,
|
||||
// HACK: build an arguments list with dummy arguments to
|
||||
// check against
|
||||
let dummy = {mode: ast::by_ref, ty: ty::mk_bot(fcx.ccx.tcx)};
|
||||
arg_tys = vec::init_elt(dummy, supplied_arg_count);
|
||||
arg_tys = vec::init_elt(supplied_arg_count, dummy);
|
||||
}
|
||||
|
||||
// Check the arguments.
|
||||
|
@ -102,9 +102,9 @@ fn mk_printer(out: io::writer, linewidth: uint) -> printer {
|
||||
// fall behind.
|
||||
let n: uint = 3u * linewidth;
|
||||
#debug("mk_printer %u", linewidth);
|
||||
let token: [mutable token] = vec::init_elt_mut(EOF, n);
|
||||
let size: [mutable int] = vec::init_elt_mut(0, n);
|
||||
let scan_stack: [mutable uint] = vec::init_elt_mut(0u, n);
|
||||
let token: [mutable token] = vec::init_elt_mut(n, EOF);
|
||||
let size: [mutable int] = vec::init_elt_mut(n, 0);
|
||||
let scan_stack: [mutable uint] = vec::init_elt_mut(n, 0u);
|
||||
let print_stack: [print_stack_elt] = [];
|
||||
@{out: out,
|
||||
buf_len: n,
|
||||
|
@ -230,7 +230,7 @@ fn check_expected_errors(expected_errors: [errors::expected_error],
|
||||
procres: procres) {
|
||||
|
||||
// true if we found the error in question
|
||||
let found_flags = vec::init_elt_mut(false, vec::len(expected_errors));
|
||||
let found_flags = vec::init_elt_mut(vec::len(expected_errors), false);
|
||||
|
||||
if procres.status == 0 {
|
||||
fatal("process did not return an error status");
|
||||
|
@ -388,7 +388,7 @@ fn get_int_precision(cv: conv) -> uint {
|
||||
|
||||
// FIXME: This might be useful in str: but needs to be utf8 safe first
|
||||
fn str_init_elt(c: char, n_elts: uint) -> str {
|
||||
let svec = vec::init_elt::<u8>(c as u8, n_elts);
|
||||
let svec = vec::init_elt::<u8>(n_elts, c as u8);
|
||||
|
||||
ret str::unsafe_from_bytes(svec);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ fn init_fn_mut<T>(n_elts: uint, op: init_op<T>) -> [mutable T] {
|
||||
Creates an immutable vector of size `n_elts` and initializes the elements
|
||||
to the value `t`.
|
||||
*/
|
||||
fn init_elt<T: copy>(t: T, n_elts: uint) -> [T] {
|
||||
fn init_elt<T: copy>(n_elts: uint, t: T) -> [T] {
|
||||
let v = [];
|
||||
reserve(v, n_elts);
|
||||
let i: uint = 0u;
|
||||
@ -138,7 +138,7 @@ fn init_elt<T: copy>(t: T, n_elts: uint) -> [T] {
|
||||
Creates a mutable vector of size `n_elts` and initializes the elements
|
||||
to the value `t`.
|
||||
*/
|
||||
fn init_elt_mut<T: copy>(t: T, n_elts: uint) -> [mutable T] {
|
||||
fn init_elt_mut<T: copy>(n_elts: uint, t: T) -> [mutable T] {
|
||||
let v = [mutable];
|
||||
reserve(v, n_elts);
|
||||
let i: uint = 0u;
|
||||
@ -1045,13 +1045,13 @@ fn test_init_fn() {
|
||||
#[test]
|
||||
fn test_init_elt() {
|
||||
// Test on-stack init_elt.
|
||||
let v = init_elt(10u, 2u);
|
||||
let v = init_elt(2u, 10u);
|
||||
assert (len(v) == 2u);
|
||||
assert (v[0] == 10u);
|
||||
assert (v[1] == 10u);
|
||||
|
||||
// Test on-heap init_elt.
|
||||
v = init_elt(20u, 6u);
|
||||
v = init_elt(6u, 20u);
|
||||
assert (v[0] == 20u);
|
||||
assert (v[1] == 20u);
|
||||
assert (v[2] == 20u);
|
||||
|
@ -49,7 +49,7 @@
|
||||
*/
|
||||
fn create(nbits: uint, init: bool) -> t {
|
||||
let elt = if init { !0u } else { 0u };
|
||||
let storage = vec::init_elt_mut::<uint>(elt, nbits / uint_bits + 1u);
|
||||
let storage = vec::init_elt_mut::<uint>(nbits / uint_bits + 1u, elt);
|
||||
ret @{storage: storage, nbits: nbits};
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ fn intersect(v0: t, v1: t) -> bool {
|
||||
Makes a copy of a bitvector
|
||||
*/
|
||||
fn clone(v: t) -> t {
|
||||
let storage = vec::init_elt_mut::<uint>(0u, v.nbits / uint_bits + 1u);
|
||||
let storage = vec::init_elt_mut::<uint>(v.nbits / uint_bits + 1u, 0u);
|
||||
let len = vec::len(v.storage);
|
||||
uint::range(0u, len) {|i| storage[i] = v.storage[i]; };
|
||||
ret @{storage: storage, nbits: v.nbits};
|
||||
|
@ -127,7 +127,7 @@ fn get(i: int) -> T {
|
||||
mutable nelts: 0u,
|
||||
mutable lo: 0u,
|
||||
mutable hi: 0u,
|
||||
mutable elts: vec::init_elt_mut(none, initial_capacity)
|
||||
mutable elts: vec::init_elt_mut(initial_capacity, none)
|
||||
};
|
||||
repr as t::<T>
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ fn get_int_precision(cv: conv) -> uint {
|
||||
|
||||
// FIXME: This might be useful in str: but needs to be utf8 safe first
|
||||
fn str_init_elt(c: char, n_elts: uint) -> str {
|
||||
let svec = vec::init_elt::<u8>(c as u8, n_elts);
|
||||
let svec = vec::init_elt::<u8>(n_elts, c as u8);
|
||||
|
||||
ret str::unsafe_from_bytes(svec);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ fn waitpid(pid: pid_t) -> i32 {
|
||||
/// followed by a path separator
|
||||
fn get_exe_path() -> option::t<fs::path> unsafe {
|
||||
let bufsize = 1023u;
|
||||
let path = str::unsafe_from_bytes(vec::init_elt(0u8, bufsize));
|
||||
let path = str::unsafe_from_bytes(vec::init_elt(bufsize, 0u8));
|
||||
let mib = [libc_constants::CTL_KERN,
|
||||
libc_constants::KERN_PROC,
|
||||
libc_constants::KERN_PROC_PATHNAME, -1i32];
|
||||
|
@ -125,7 +125,7 @@ fn waitpid(pid: pid_t) -> i32 {
|
||||
/// followed by a path separator
|
||||
fn get_exe_path() -> option::t<fs::path> {
|
||||
let bufsize = 1023u;
|
||||
let path = str::unsafe_from_bytes(vec::init_elt(0u8, bufsize));
|
||||
let path = str::unsafe_from_bytes(vec::init_elt(bufsize, 0u8));
|
||||
ret str::as_buf("/proc/self/exe", { |proc_self_buf|
|
||||
str::as_buf(path, { |path_buf|
|
||||
if libc::readlink(proc_self_buf, path_buf, bufsize) != -1 {
|
||||
|
@ -134,7 +134,7 @@ fn _NSGetExecutablePath(buf: str::sbuf,
|
||||
fn get_exe_path() -> option::t<fs::path> {
|
||||
// FIXME: This doesn't handle the case where the buffer is too small
|
||||
let bufsize = 1023u32;
|
||||
let path = str::unsafe_from_bytes(vec::init_elt(0u8, bufsize as uint));
|
||||
let path = str::unsafe_from_bytes(vec::init_elt(bufsize as uint, 0u8));
|
||||
ret str::as_buf(path, { |path_buf|
|
||||
if mac_libc::_NSGetExecutablePath(path_buf,
|
||||
ptr::mut_addr_of(bufsize)) == 0i32 {
|
||||
|
@ -242,7 +242,7 @@ fn remove<K: copy, V: copy>(tbl: t<K,V>, k: K) -> core::option::t<V> {
|
||||
}
|
||||
|
||||
fn chains<K: copy, V: copy>(nchains: uint) -> [mutable chain<K,V>] {
|
||||
ret vec::init_elt_mut(absent, nchains);
|
||||
ret vec::init_elt_mut(nchains, absent);
|
||||
}
|
||||
|
||||
fn foreach_entry<K: copy, V: copy>(chain0: chain<K,V>,
|
||||
|
@ -25,7 +25,7 @@ fn rot(r: int, x: u32) -> u32 {
|
||||
}
|
||||
|
||||
let i = 0u, e = vec::len(msg);
|
||||
let x = vec::init_elt_mut(0u32, 16u);
|
||||
let x = vec::init_elt_mut(16u, 0u32);
|
||||
while i < e {
|
||||
let aa = a, bb = b, cc = c, dd = d;
|
||||
|
||||
|
@ -181,7 +181,7 @@ fn concat(v: [rope]) -> rope {
|
||||
//Copy `v` into a mutable vector
|
||||
let len = vec::len(v);
|
||||
if len == 0u { ret node::empty; }
|
||||
let ropes = vec::init_elt_mut(v[0], len);
|
||||
let ropes = vec::init_elt_mut(len, v[0]);
|
||||
uint::range(1u, len) {|i|
|
||||
ropes[i] = v[i];
|
||||
}
|
||||
@ -779,7 +779,7 @@ fn of_substr_unsafer(str: @str, byte_start: uint, byte_len: uint,
|
||||
//Firstly, split `str` in slices of hint_max_leaf_char_len
|
||||
let leaves = uint::div_ceil(char_len, hint_max_leaf_char_len);
|
||||
//Number of leaves
|
||||
let nodes = vec::init_elt_mut(candidate, leaves);
|
||||
let nodes = vec::init_elt_mut(leaves, candidate);
|
||||
|
||||
let i = 0u;
|
||||
let offset = byte_start;
|
||||
@ -892,7 +892,7 @@ fn tree_from_forest_destructive(forest: [mutable @node]) -> @node {
|
||||
}
|
||||
|
||||
fn serialize_node(node: @node) -> str unsafe {
|
||||
let buf = vec::init_elt_mut(0u8, byte_len(node));
|
||||
let buf = vec::init_elt_mut(byte_len(node), 0u8);
|
||||
let offset = 0u;//Current position in the buffer
|
||||
let it = leaf_iterator::start(node);
|
||||
while true {
|
||||
@ -1223,7 +1223,7 @@ fn empty() -> t {
|
||||
}
|
||||
|
||||
fn start(node: @node) -> t {
|
||||
let stack = vec::init_elt_mut(node, height(node)+1u);
|
||||
let stack = vec::init_elt_mut(height(node)+1u, node);
|
||||
ret {
|
||||
stack: stack,
|
||||
mutable stackpos: 0
|
||||
@ -1490,7 +1490,7 @@ fn concat1() {
|
||||
}
|
||||
|
||||
//Same rope, obtained with rope::concat
|
||||
let r2 = concat(vec::init_elt(chunk, 10u));
|
||||
let r2 = concat(vec::init_elt(10u, chunk));
|
||||
|
||||
assert eq(r, r2);
|
||||
}
|
||||
|
@ -274,13 +274,13 @@ fn result_str() -> str {
|
||||
}
|
||||
}
|
||||
let st = {
|
||||
h: vec::init_elt_mut(0u32, digest_buf_len),
|
||||
h: vec::init_elt_mut(digest_buf_len, 0u32),
|
||||
mutable len_low: 0u32,
|
||||
mutable len_high: 0u32,
|
||||
msg_block: vec::init_elt_mut(0u8, msg_block_len),
|
||||
msg_block: vec::init_elt_mut(msg_block_len, 0u8),
|
||||
mutable msg_block_idx: 0u,
|
||||
mutable computed: false,
|
||||
work_buf: vec::init_elt_mut(0u32, work_buf_len)
|
||||
work_buf: vec::init_elt_mut(work_buf_len, 0u32)
|
||||
};
|
||||
let sh = st as sha1;
|
||||
sh.reset();
|
||||
|
@ -114,7 +114,7 @@ fn fsync_fd(fd: fd_t, level: io::fsync::level) -> c_int {
|
||||
fn get_exe_path() -> option::t<fs::path> {
|
||||
// FIXME: This doesn't handle the case where the buffer is too small
|
||||
let bufsize = 1023u;
|
||||
let path = str::unsafe_from_bytes(vec::init_elt(0u8, bufsize));
|
||||
let path = str::unsafe_from_bytes(vec::init_elt(bufsize, 0u8));
|
||||
ret str::as_buf(path, { |path_buf|
|
||||
if kernel32::GetModuleFileNameA(0u, path_buf,
|
||||
bufsize as u32) != 0u32 {
|
||||
|
@ -39,7 +39,7 @@ enum hlvl {
|
||||
}
|
||||
|
||||
fn write_header(ctxt: ctxt, lvl: hlvl, title: str) {
|
||||
let hashes = str::from_chars(vec::init_elt('#', lvl as uint));
|
||||
let hashes = str::from_chars(vec::init_elt(lvl as uint, '#'));
|
||||
ctxt.w.write_line(#fmt("%s %s", hashes, title));
|
||||
ctxt.w.write_line("");
|
||||
}
|
||||
|
@ -6,9 +6,9 @@
|
||||
fn fannkuch(n: int) -> int {
|
||||
fn perm1init(i: uint) -> int { ret i as int; }
|
||||
|
||||
let perm = vec::init_elt_mut(0, n as uint);
|
||||
let perm = vec::init_elt_mut(n as uint, 0);
|
||||
let perm1 = vec::init_fn_mut(n as uint, perm1init);
|
||||
let count = vec::init_elt_mut(0, n as uint);
|
||||
let count = vec::init_elt_mut(n as uint, 0);
|
||||
let f = 0;
|
||||
let i = 0;
|
||||
let k = 0;
|
||||
|
@ -31,7 +31,7 @@ enum grid_t { grid_ctor(grid), }
|
||||
fn read_grid(f: io::reader) -> grid_t {
|
||||
assert f.read_line() == "9,9"; /* assert first line is exactly "9,9" */
|
||||
|
||||
let g = vec::init_fn(10u, {|_i| vec::init_elt_mut(0 as u8, 10u) });
|
||||
let g = vec::init_fn(10u, {|_i| vec::init_elt_mut(10u, 0 as u8) });
|
||||
while !f.eof() {
|
||||
// FIXME: replace with unicode compliant call
|
||||
let comps = str::split(str::trim(f.read_line()), ',' as u8);
|
||||
@ -130,7 +130,7 @@ fn write_grid(f: io::writer, g: grid_t) {
|
||||
fn main(args: [str]) {
|
||||
let grid = if vec::len(args) == 1u {
|
||||
// FIXME create sudoku inline since nested vec consts dont work yet
|
||||
let g = vec::init_fn(10u, {|_i| vec::init_elt_mut(0 as u8, 10u) });
|
||||
let g = vec::init_fn(10u, {|_i| vec::init_elt_mut(10u, 0 as u8) });
|
||||
g[0][1] = 4u8;
|
||||
g[0][3] = 6u8;
|
||||
g[0][7] = 3u8;
|
||||
|
@ -3,7 +3,7 @@
|
||||
import vec::*;
|
||||
|
||||
fn main() {
|
||||
let v = init_elt(0, 0u);
|
||||
let v = init_elt(0u, 0);
|
||||
v += [4, 2];
|
||||
assert (reversed(v) == [2, 4]);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
mod m {
|
||||
use std;
|
||||
import vec;
|
||||
fn f() -> [int] { vec::init_elt(0, 1u) }
|
||||
fn f() -> [int] { vec::init_elt(1u, 0) }
|
||||
}
|
||||
|
||||
fn main() { let x = m::f(); }
|
||||
|
Loading…
Reference in New Issue
Block a user