]> git.lizzy.rs Git - rust.git/commitdiff
Port the stdlib to the ivec type [T] syntax.
authorErick Tryzelaar <erick.tryzelaar@gmail.com>
Fri, 5 Aug 2011 00:24:54 +0000 (17:24 -0700)
committerBrian Anderson <banderson@mozilla.com>
Tue, 9 Aug 2011 22:53:26 +0000 (15:53 -0700)
20 files changed:
src/lib/aio.rs
src/lib/bitv.rs
src/lib/deque.rs
src/lib/ebml.rs
src/lib/either.rs
src/lib/fs.rs
src/lib/getopts.rs
src/lib/ioivec.rs
src/lib/ivec.rs
src/lib/map.rs
src/lib/posix_fs.rs
src/lib/sha1.rs
src/lib/sio.rs
src/lib/smallintmap.rs
src/lib/sort.rs
src/lib/str.rs
src/lib/test.rs
src/lib/ufind.rs
src/lib/ufindivec.rs
src/lib/win32_fs.rs

index b6f5730d8505bc4154ec008a2b5c2c02197190e3..81c6ddf80fb734dfb5ade670b1c10d89386907b6 100644 (file)
@@ -10,7 +10,7 @@
     fn aio_connect(host: sbuf, port: int, connected: chan[socket]);
     fn aio_serve(host: sbuf, port: int, acceptChan: chan[socket]) -> server;
     fn aio_writedata(s: socket, buf: *u8, size: uint, status: chan[bool]);
-    fn aio_read(s: socket, reader: chan[u8[]]);
+    fn aio_read(s: socket, reader: chan[[u8]]);
     fn aio_close_server(s: server, status: chan[bool]);
     fn aio_close_socket(s: socket);
     fn aio_is_null_client(s: socket) -> bool;
@@ -26,7 +26,7 @@
 tag socket_event {
     connected(client);
     closed;
-    received(u8[]);
+    received([u8]);
 }
 
 tag server_event {
@@ -37,7 +37,7 @@
     quit;
     connect(pending_connection,chan[socket_event]);
     serve(str,int,chan[server_event],chan[server]);
-    write(client,u8[],chan[bool]);
+    write(client,[u8],chan[bool]);
     close_server(server, chan[bool]);
     close_client(client);
 }
@@ -56,14 +56,14 @@ fn new_client(client: client, evt: chan[socket_event]) {
     // Start the read before notifying about the connect.  This avoids a race
     // condition where the receiver can close the socket before we start
     // reading.
-    let reader: port[u8[]] = port();
+    let reader: port[[u8]] = port();
     rustrt::aio_read(client, chan(reader));
 
     evt <| connected(client);
 
     while (true) {
         log "waiting for bytes";
-        let data: u8[];
+        let data: [u8];
         reader |> data;
         log "got some bytes";
         log ivec::len[u8](data);
index 8201264135d75d7f7a51d4c1016a92de39263692..b5b376be5c189cd6572c7480def785fd7ba65583 100644 (file)
@@ -24,7 +24,7 @@
 //        an optimizing version of this module that produces a different obj
 //        for the case where nbits <= 32.
 
-type t = @{storage: uint[mutable ], nbits: uint};
+type t = @{storage: [mutable uint], nbits: uint};
 
 
 // FIXME: this should be a constant once they work
@@ -150,7 +150,7 @@ fn to_vec(v: &t) -> vec[uint] {
     ret vec::init_fn[uint](sub, v.nbits);
 }
 
-fn to_ivec(v: &t) -> uint[] {
+fn to_ivec(v: &t) -> [uint] {
     let sub = bind init_to_vec(v, _);
     ret ivec::init_fn[uint](sub, v.nbits);
 }
@@ -178,7 +178,7 @@ fn eq_vec(v0: &t, v1: &vec[uint]) -> bool {
     ret true;
 }
 
-fn eq_ivec(v0: &t, v1: &uint[]) -> bool {
+fn eq_ivec(v0: &t, v1: &[uint]) -> bool {
     assert (v0.nbits == ivec::len[uint](v1));
     let len = v0.nbits;
     let i = 0u;
index a501cfaf8f1e4f70cd595cbc6bca714c660d8476..a6c43572bb5dd7e7e27f2522615e05de74619f57 100644 (file)
@@ -26,10 +26,10 @@ fn create[@T]() -> t[T] {
       */
 
 
-    fn grow[@T](nelts: uint, lo: uint, elts: &(cell[T])[mutable ]) ->
-       (cell[T])[mutable ] {
+    fn grow[@T](nelts: uint, lo: uint, elts: &[mutable cell[T]]) ->
+       [mutable cell[T]] {
         assert (nelts == ivec::len(elts));
-        let rv = ~[mutable ];
+        let rv = ~[mutable];
 
         let i = 0u;
         let nalloc = uint::next_power_of_two(nelts + 1u);
@@ -42,13 +42,13 @@ fn grow[@T](nelts: uint, lo: uint, elts: &(cell[T])[mutable ]) ->
 
         ret rv;
     }
-    fn get[@T](elts: &(cell[T])[mutable ], i: uint) -> T {
+    fn get[@T](elts: &[mutable cell[T]], i: uint) -> T {
         ret alt elts.(i) { option::some(t) { t } _ { fail } };
     }
     obj deque[@T](mutable nelts: uint,
                   mutable lo: uint,
                   mutable hi: uint,
-                  mutable elts: (cell[T])[mutable ]) {
+                  mutable elts: [mutable cell[T]]) {
         fn size() -> uint { ret nelts; }
         fn add_front(t: &T) {
             let oldlo: uint = lo;
@@ -101,7 +101,7 @@ fn get(i: int) -> T {
             ret get[T](elts, idx);
         }
     }
-    let v: (cell[T])[mutable ] =
+    let v: [mutable cell[T]] =
         ivec::init_elt_mut(option::none, initial_capacity);
     ret deque[T](0u, 0u, 0u, v);
 }
index 41e5bf03b1a32d19180c2fd59259fa05e32c7163..1fb5860b4a0c25e423d074117a1fb9959b75c320 100644 (file)
@@ -15,9 +15,9 @@
 // modules within this file.
 
 // ebml reading
-type doc = {data: @u8[], start: uint, end: uint};
+type doc = {data: @[u8], start: uint, end: uint};
 
-fn vint_at(data: &u8[], start: uint) -> {val: uint, next: uint} {
+fn vint_at(data: &[u8], start: uint) -> {val: uint, next: uint} {
     let a = data.(start);
     if a & 0x80u8 != 0u8 { ret {val: a & 0x7fu8 as uint, next: start + 1u}; }
     if a & 0x40u8 != 0u8 {
@@ -39,11 +39,11 @@ fn vint_at(data: &u8[], start: uint) -> {val: uint, next: uint} {
     } else { log_err "vint too big"; fail; }
 }
 
-fn new_doc(data: &@u8[]) -> doc {
+fn new_doc(data: &@[u8]) -> doc {
     ret {data: data, start: 0u, end: ivec::len[u8](*data)};
 }
 
-fn doc_at(data: &@u8[], start: uint) -> doc {
+fn doc_at(data: &@[u8], start: uint) -> doc {
     let elt_tag = vint_at(*data, start);
     let elt_size = vint_at(*data, elt_tag.next);
     let end = elt_size.next + elt_size.val;
@@ -96,9 +96,9 @@ fn get_doc(d: doc, tg: uint) -> doc {
     }
 }
 
-fn doc_data(d: doc) -> u8[] { ret ivec::slice[u8](*d.data, d.start, d.end); }
+fn doc_data(d: doc) -> [u8] { ret ivec::slice[u8](*d.data, d.start, d.end); }
 
-fn be_uint_from_bytes(data: &@u8[], start: uint, size: uint) -> uint {
+fn be_uint_from_bytes(data: &@[u8], start: uint, size: uint) -> uint {
     let sz = size;
     assert (sz <= 4u);
     let val = 0u;
@@ -117,10 +117,10 @@ fn doc_as_uint(d: doc) -> uint {
 
 
 // ebml writing
-type writer = {writer: ioivec::buf_writer, mutable size_positions: uint[]};
+type writer = {writer: ioivec::buf_writer, mutable size_positions: [uint]};
 
 fn write_sized_vint(w: &ioivec::buf_writer, n: uint, size: uint) {
-    let buf: u8[];
+    let buf: [u8];
     alt size {
       1u { buf = ~[0x80u8 | (n as u8)]; }
       2u { buf = ~[0x40u8 | (n >> 8u as u8), n & 0xffu as u8]; }
@@ -149,7 +149,7 @@ fn write_vint(w: &ioivec::buf_writer, n: uint) {
 }
 
 fn create_writer(w: &ioivec::buf_writer) -> writer {
-    let size_positions: uint[] = ~[];
+    let size_positions: [uint] = ~[];
     ret {writer: w, mutable size_positions: size_positions};
 }
 
@@ -162,7 +162,7 @@ fn start_tag(w: &writer, tag_id: uint) {
     // Write a placeholder four-byte size.
 
     w.size_positions += ~[w.writer.tell()];
-    let zeroes: u8[] = ~[0u8, 0u8, 0u8, 0u8];
+    let zeroes: [u8] = ~[0u8, 0u8, 0u8, 0u8];
     w.writer.write(zeroes);
 }
 
index a410acd83ad33690f22f2a3ae5ae527dff4495fa..5ca232a617f17027bdb9a624f8ee46cab9196f89 100644 (file)
@@ -13,25 +13,25 @@ fn either[T, U,
     alt value { left(l) { f_left(l) } right(r) { f_right(r) } }
 }
 
-fn lefts[T, U](eithers: &(t[T, U])[]) -> T[] {
-    let result: T[] = ~[];
+fn lefts[T, U](eithers: &[t[T, U]]) -> [T] {
+    let result: [T] = ~[];
     for elt: t[T, U]  in eithers {
         alt elt { left(l) { result += ~[l] } _ {/* fallthrough */ } }
     }
     ret result;
 }
 
-fn rights[T, U](eithers: &(t[T, U])[]) -> U[] {
-    let result: U[] = ~[];
+fn rights[T, U](eithers: &[t[T, U]]) -> [U] {
+    let result: [U] = ~[];
     for elt: t[T, U]  in eithers {
         alt elt { right(r) { result += ~[r] } _ {/* fallthrough */ } }
     }
     ret result;
 }
 
-fn partition[T, U](eithers: &(t[T, U])[]) -> {lefts: T[], rights: U[]} {
-    let lefts: T[] = ~[];
-    let rights: U[] = ~[];
+fn partition[T, U](eithers: &[t[T, U]]) -> {lefts: [T], rights: [U]} {
+    let lefts: [T] = ~[];
+    let rights: [U] = ~[];
     for elt: t[T, U]  in eithers {
         alt elt { left(l) { lefts += ~[l] } right(r) { rights += ~[r] } }
     }
index 7a4467fecd0c937894b5d77b7c7e41c865808d01..9f47b2d11f7f44d38871e3cde5818c4b706ce5b5 100644 (file)
@@ -44,10 +44,10 @@ fn connect(pre: path, post: path) -> path {
 
 fn file_is_dir(p: path) -> bool { ret rustrt::rust_file_is_dir(p) != 0; }
 
-fn list_dir(p: path) -> str[] {
+fn list_dir(p: path) -> [str] {
     let pl = str::byte_len(p);
     if pl == 0u || p.(pl - 1u) as char != os_fs::path_sep { p += path_sep(); }
-    let full_paths: str[] = ~[];
+    let full_paths: [str] = ~[];
     for filename: str  in os_fs::list_dir(p) {
         if !str::eq(filename, ".") {
             if !str::eq(filename, "..") { full_paths += ~[p + filename]; }
index bb2a58c1cc041f5e2c2f5e712f51789afff4627d..3ae030e8717f087d8b3dda445a18bd3c95632736 100644 (file)
@@ -66,7 +66,7 @@ fn optmulti(name: str) -> opt {
 
 tag optval { val(str); given; }
 
-type match = {opts: opt[], vals: optval[][mutable ], free: vec[str]};
+type match = {opts: [opt], vals: [mutable [optval]], free: vec[str]};
 
 fn is_arg(arg: str) -> bool {
     ret str::byte_len(arg) > 1u && arg.(0) == '-' as u8;
@@ -76,7 +76,7 @@ fn name_str(nm: name) -> str {
     ret alt nm { short(ch) { str::from_char(ch) } long(s) { s } };
 }
 
-fn find_opt(opts: &opt[], nm: name) -> option::t[uint] {
+fn find_opt(opts: &[opt], nm: name) -> option::t[uint] {
     let i = 0u;
     let l = ivec::len[opt](opts);
     while i < l { if opts.(i).name == nm { ret some[uint](i); } i += 1u; }
@@ -116,10 +116,10 @@ fn getopts(args: vec[str], opts: vec[opt]) -> result {
     ret getopts_ivec(args_ivec, opts_ivec);
 }
 
-fn getopts_ivec(args: &str[], opts: &opt[]) -> result {
+fn getopts_ivec(args: &[str], opts: &[opt]) -> result {
     let n_opts = ivec::len[opt](opts);
-    fn f(x: uint) -> optval[] { ret ~[]; }
-    let vals = ivec::init_fn_mut[optval[]](f, n_opts);
+    fn f(x: uint) -> [optval] { ret ~[]; }
+    let vals = ivec::init_fn_mut[[optval]](f, n_opts);
     let free: vec[str] = [];
     let l = ivec::len[str](args);
     let i = 0u;
@@ -209,7 +209,7 @@ fn getopts_ivec(args: &str[], opts: &opt[]) -> result {
     ret success({opts: opts, vals: vals, free: free});
 }
 
-fn opt_vals(m: &match, nm: str) -> optval[] {
+fn opt_vals(m: &match, nm: str) -> [optval] {
     ret alt find_opt(m.opts, mkname(nm)) {
           some(id) { m.vals.(id) }
           none. { log_err "No option '" + nm + "' defined."; fail }
@@ -234,8 +234,8 @@ fn opt_strs(m: &match, nm: str) -> vec[str] {
     ret acc;
 }
 
-fn opt_strs_ivec(m: &match, nm: str) -> str[] {
-    let acc: str[] = ~[];
+fn opt_strs_ivec(m: &match, nm: str) -> [str] {
+    let acc: [str] = ~[];
     for v: optval  in opt_vals(m, nm) {
         alt v { val(s) { acc += ~[s]; } _ { } }
     }
index 728a1d0e3d2726ff3245621289747c7f563a69a1..95c0e4254250723571ab4b0a60bc5f1251088f18 100644 (file)
@@ -19,7 +19,7 @@
     // FIXME: Seekable really should be orthogonal. We will need
     // inheritance.
     obj {
-        fn read(uint) -> u8[] ;
+        fn read(uint) -> [u8] ;
         fn read_byte() -> int ;
         fn unread_byte(int) ;
         fn eof() -> bool ;
@@ -38,7 +38,7 @@
         fn get_buf_reader() -> buf_reader ;
         fn read_byte() -> int ;
         fn unread_byte(int) ;
-        fn read_bytes(uint) -> u8[] ;
+        fn read_bytes(uint) -> [u8] ;
         fn read_char() -> char ;
         fn eof() -> bool ;
         fn read_line() -> str ;
@@ -46,7 +46,7 @@
         fn read_le_uint(uint) -> uint ;
         fn read_le_int(uint) -> int ;
         fn read_be_uint(uint) -> uint ;
-        fn read_whole_stream() -> u8[] ;
+        fn read_whole_stream() -> [u8] ;
         fn seek(int, seek_style) ;
         fn tell() -> uint ;
     };
@@ -60,7 +60,7 @@ fn convert_whence(whence: seek_style) -> int {
 }
 
 obj FILE_buf_reader(f: os::libc::FILE, res: option::t[@FILE_res]) {
-    fn read(len: uint) -> u8[] {
+    fn read(len: uint) -> [u8] {
         let buf = ~[];
         ivec::reserve[u8](buf, len);
         let read = os::libc_ivec::fread(ivec::to_ptr[u8](buf), 1u, len, f);
@@ -84,7 +84,7 @@ fn tell() -> uint {
     fn get_buf_reader() -> buf_reader { ret rdr; }
     fn read_byte() -> int { ret rdr.read_byte(); }
     fn unread_byte(byte: int) { ret rdr.unread_byte(byte); }
-    fn read_bytes(len: uint) -> u8[] { ret rdr.read(len); }
+    fn read_bytes(len: uint) -> [u8] { ret rdr.read(len); }
     fn read_char() -> char {
         let c0 = rdr.read_byte();
         if c0 == -1 {
@@ -111,7 +111,7 @@ fn read_char() -> char {
     }
     fn eof() -> bool { ret rdr.eof(); }
     fn read_line() -> str {
-        let buf: u8[] = ~[];
+        let buf: [u8] = ~[];
         // No break yet in rustc
 
         let go_on = true;
@@ -124,7 +124,7 @@ fn read_line() -> str {
         ret str::unsafe_from_bytes_ivec(buf);
     }
     fn read_c_str() -> str {
-        let buf: u8[] = ~[];
+        let buf: [u8] = ~[];
         let go_on = true;
         while go_on {
             let ch = rdr.read_byte();
@@ -165,8 +165,8 @@ fn read_be_uint(sz: uint) -> uint {
         }
         ret val;
     }
-    fn read_whole_stream() -> u8[] {
-        let buf: u8[] = ~[];
+    fn read_whole_stream() -> [u8] {
+        let buf: [u8] = ~[];
         while !rdr.eof() { buf += rdr.read(2048u); }
         ret buf;
     }
@@ -192,10 +192,10 @@ fn file_reader(path: str) -> reader {
 // Byte buffer readers
 
 // TODO: mutable? u8, but this fails with rustboot.
-type byte_buf = @{buf: u8[], mutable pos: uint};
+type byte_buf = @{buf: [u8], mutable pos: uint};
 
 obj byte_buf_reader(bbuf: byte_buf) {
-    fn read(len: uint) -> u8[] {
+    fn read(len: uint) -> [u8] {
         let rest = ivec::len[u8](bbuf.buf) - bbuf.pos;
         let to_read = len;
         if rest < to_read { to_read = rest; }
@@ -219,7 +219,7 @@ fn seek(offset: int, whence: seek_style) {
     fn tell() -> uint { ret bbuf.pos; }
 }
 
-fn new_byte_buf_reader(buf: &u8[]) -> buf_reader {
+fn new_byte_buf_reader(buf: &[u8]) -> buf_reader {
     ret byte_buf_reader(@{buf: buf, mutable pos: 0u});
 }
 
@@ -238,13 +238,13 @@ fn string_reader(s: &str) -> reader {
      // FIXME: eventually u64
 
     obj {
-        fn write(&u8[]) ;
+        fn write(&[u8]) ;
         fn seek(int, seek_style) ;
         fn tell() -> uint ;
     };
 
 obj FILE_writer(f: os::libc::FILE, res: option::t[@FILE_res]) {
-    fn write(v: &u8[]) {
+    fn write(v: &[u8]) {
         let len = ivec::len[u8](v);
         let vbuf = ivec::to_ptr[u8](v);
         let nout = os::libc_ivec::fwrite(vbuf, len, 1u, f);
@@ -263,7 +263,7 @@ fn tell() -> uint {
 }
 
 obj fd_buf_writer(fd: int, res: option::t[@fd_res]) {
-    fn write(v: &u8[]) {
+    fn write(v: &[u8]) {
         let len = ivec::len[u8](v);
         let count = 0u;
         let vbuf;
@@ -288,7 +288,7 @@ fn tell() -> uint {
     }
 }
 
-fn file_buf_writer(path: str, flags: &fileflag[]) -> buf_writer {
+fn file_buf_writer(path: str, flags: &[fileflag]) -> buf_writer {
     let fflags: int =
         os::libc_constants::O_WRONLY() | os::libc_constants::O_BINARY();
     for f: fileflag  in flags {
@@ -322,20 +322,20 @@ fn file_buf_writer(path: str, flags: &fileflag[]) -> buf_writer {
         fn write_char(char) ;
         fn write_int(int) ;
         fn write_uint(uint) ;
-        fn write_bytes(&u8[]) ;
+        fn write_bytes(&[u8]) ;
         fn write_le_uint(uint, uint) ;
         fn write_le_int(int, uint) ;
         fn write_be_uint(uint, uint) ;
     };
 
-fn uint_to_le_bytes(n: uint, size: uint) -> u8[] {
-    let bytes: u8[] = ~[];
+fn uint_to_le_bytes(n: uint, size: uint) -> [u8] {
+    let bytes: [u8] = ~[];
     while size > 0u { bytes += ~[n & 255u as u8]; n >>= 8u; size -= 1u; }
     ret bytes;
 }
 
-fn uint_to_be_bytes(n: uint, size: uint) -> u8[] {
-    let bytes: u8[] = ~[];
+fn uint_to_be_bytes(n: uint, size: uint) -> [u8] {
+    let bytes: [u8] = ~[];
     let i = size - 1u as int;
     while i >= 0 { bytes += ~[n >> (i * 8 as uint) & 255u as u8]; i -= 1; }
     ret bytes;
@@ -357,7 +357,7 @@ fn write_char(ch: char) {
     fn write_uint(n: uint) {
         out.write(str::bytes_ivec(uint::to_str(n, 10u)));
     }
-    fn write_bytes(bytes: &u8[]) { out.write(bytes); }
+    fn write_bytes(bytes: &[u8]) { out.write(bytes); }
     fn write_le_uint(n: uint, size: uint) {
         out.write(uint_to_le_bytes(n, size));
     }
@@ -373,7 +373,7 @@ fn write_be_uint(n: uint, size: uint) {
 // FIXME: Remove me once objects are exported.
 fn new_writer_(out: buf_writer) -> writer { ret new_writer(out); }
 
-fn file_writer(path: str, flags: &fileflag[]) -> writer {
+fn file_writer(path: str, flags: &[fileflag]) -> writer {
     ret new_writer(file_buf_writer(path, flags));
 }
 
@@ -395,10 +395,10 @@ fn buffered_file_buf_writer(path: str) -> buf_writer {
         fn get_str() -> str ;
     };
 
-type mutable_byte_buf = @{mutable buf: u8[mutable ], mutable pos: uint};
+type mutable_byte_buf = @{mutable buf: [mutable u8], mutable pos: uint};
 
 obj byte_buf_writer(buf: mutable_byte_buf) {
-    fn write(v: &u8[]) {
+    fn write(v: &[u8]) {
         // Fast path.
 
         if buf.pos == ivec::len(buf.buf) {
@@ -430,7 +430,7 @@ fn seek(offset: int, whence: seek_style) {
 fn string_writer() -> str_writer {
     // FIXME: yikes, this is bad. Needs fixing of mutable syntax.
 
-    let b: u8[mutable ] = ~[mutable 0u8];
+    let b: [mutable u8] = ~[mutable 0u8];
     ivec::pop(b);
     let buf: mutable_byte_buf = @{mutable buf: b, mutable pos: 0u};
     obj str_writer_wrap(wr: writer, buf: mutable_byte_buf) {
@@ -459,7 +459,7 @@ fn read_whole_file_str(file: &str) -> str {
     str::unsafe_from_bytes_ivec(read_whole_file(file))
 }
 
-fn read_whole_file(file: &str) -> u8[] {
+fn read_whole_file(file: &str) -> [u8] {
     // FIXME: There's a lot of copying here
     file_reader(file).read_whole_stream()
 }
index fb9df536df35ffa100000ff858a39e070bdc39bc..a60b8aa63de4f92bbf1208bcec054e6b3d0c6eaa 100644 (file)
@@ -8,26 +8,26 @@
 type operator2[T, U, V] = fn(&T, &U) -> V ;
 
 native "rust-intrinsic" mod rusti {
-    fn ivec_len[T](v: &T[]) -> uint;
+    fn ivec_len[T](v: &[T]) -> uint;
 }
 
 native "rust" mod rustrt {
-    fn ivec_reserve_shared[T](v: &mutable T[mutable? ], n: uint);
-    fn ivec_on_heap[T](v: &T[]) -> uint;
-    fn ivec_to_ptr[T](v: &T[]) -> *T;
-    fn ivec_copy_from_buf_shared[T](v: &mutable T[mutable? ], ptr: *T,
+    fn ivec_reserve_shared[T](v: &mutable [mutable? T], n: uint);
+    fn ivec_on_heap[T](v: &[T]) -> uint;
+    fn ivec_to_ptr[T](v: &[T]) -> *T;
+    fn ivec_copy_from_buf_shared[T](v: &mutable [mutable? T], ptr: *T,
                                     count: uint);
 }
 
-fn from_vec[@T](v: &vec[T]) -> T[] {
-    let iv: T[] = ~[];
+fn from_vec[@T](v: &vec[T]) -> [T] {
+    let iv = ~[];
     for e in v {
         iv += ~[e];
     }
     ret iv;
 }
 
-fn to_vec[@T](iv: &T[]) -> vec[T] {
+fn to_vec[@T](iv: &[T]) -> vec[T] {
     let v: vec[T] = [];
     for e in iv {
         v += [e];
@@ -36,19 +36,19 @@ fn to_vec[@T](iv: &T[]) -> vec[T] {
 }
 
 /// Reserves space for `n` elements in the given vector.
-fn reserve[@T](v: &mutable T[mutable? ], n: uint) {
+fn reserve[@T](v: &mutable [mutable? T], n: uint) {
     rustrt::ivec_reserve_shared(v, n);
 }
 
-fn on_heap[T](v: &T[]) -> bool { ret rustrt::ivec_on_heap(v) != 0u; }
+fn on_heap[T](v: &[T]) -> bool { ret rustrt::ivec_on_heap(v) != 0u; }
 
-fn to_ptr[T](v: &T[]) -> *T { ret rustrt::ivec_to_ptr(v); }
+fn to_ptr[T](v: &[T]) -> *T { ret rustrt::ivec_to_ptr(v); }
 
-fn len[T](v: &T[mutable? ]) -> uint { ret rusti::ivec_len(v); }
+fn len[T](v: &[mutable? T]) -> uint { ret rusti::ivec_len(v); }
 
 type init_op[T] = fn(uint) -> T ;
 
-fn init_fn[@T](op: &init_op[T], n_elts: uint) -> T[] {
+fn init_fn[@T](op: &init_op[T], n_elts: uint) -> [T] {
     let v = ~[];
     reserve(v, n_elts);
     let i: uint = 0u;
@@ -57,15 +57,15 @@ fn init_fn[@T](op: &init_op[T], n_elts: uint) -> T[] {
 }
 
 // TODO: Remove me once we have slots.
-fn init_fn_mut[@T](op: &init_op[T], n_elts: uint) -> T[mutable ] {
-    let v = ~[mutable ];
+fn init_fn_mut[@T](op: &init_op[T], n_elts: uint) -> [mutable T] {
+    let v = ~[mutable];
     reserve(v, n_elts);
     let i: uint = 0u;
     while i < n_elts { v += ~[mutable op(i)]; i += 1u; }
     ret v;
 }
 
-fn init_elt[@T](t: &T, n_elts: uint) -> T[] {
+fn init_elt[@T](t: &T, n_elts: uint) -> [T] {
     let v = ~[];
     reserve(v, n_elts);
     let i: uint = 0u;
@@ -74,53 +74,53 @@ fn init_elt[@T](t: &T, n_elts: uint) -> T[] {
 }
 
 // TODO: Remove me once we have slots.
-fn init_elt_mut[@T](t: &T, n_elts: uint) -> T[mutable ] {
-    let v = ~[mutable ];
+fn init_elt_mut[@T](t: &T, n_elts: uint) -> [mutable T] {
+    let v = ~[mutable];
     reserve(v, n_elts);
     let i: uint = 0u;
     while i < n_elts { v += ~[mutable t]; i += 1u; }
     ret v;
 }
 
-fn to_mut[@T](v: &T[]) -> T[mutable ] {
-    let vres = ~[mutable ];
+fn to_mut[@T](v: &[T]) -> [mutable T] {
+    let vres = ~[mutable];
     for t: T  in v { vres += ~[mutable t]; }
     ret vres;
 }
 
-fn from_mut[@T](v: &T[mutable ]) -> T[] {
+fn from_mut[@T](v: &[mutable T]) -> [T] {
     let vres = ~[];
     for t: T  in v { vres += ~[t]; }
     ret vres;
 }
 
 // Predicates
-pred is_empty[T](v: &T[mutable? ]) -> bool {
+pred is_empty[T](v: &[mutable? T]) -> bool {
     // FIXME: This would be easier if we could just call len
     for t: T in v { ret false; }
     ret true;
 }
 
-pred is_not_empty[T](v: &T[mutable? ]) -> bool { ret !is_empty(v); }
+pred is_not_empty[T](v: &[mutable? T]) -> bool { ret !is_empty(v); }
 
 // Accessors
 
 /// Returns the first element of a vector
-fn head[@T](v: &T[mutable?]) : is_not_empty(v) -> T { ret v.(0); }
+fn head[@T](v: &[mutable? T]) : is_not_empty(v) -> T { ret v.(0); }
 
 /// Returns all but the first element of a vector
-fn tail[@T](v: &T[mutable? ]) : is_not_empty(v)  -> T[mutable?] {
+fn tail[@T](v: &[mutable? T]) : is_not_empty(v) -> [mutable? T] {
     ret slice(v, 1u, len(v));
 }
 
 /// Returns the last element of `v`.
-fn last[@T](v: &T[mutable? ]) -> option::t[T] {
+fn last[@T](v: &[mutable? T]) -> option::t[T] {
     if len(v) == 0u { ret none; }
     ret some(v.(len(v) - 1u));
 }
 
 /// Returns a copy of the elements from [`start`..`end`) from `v`.
-fn slice[@T](v: &T[mutable? ], start: uint, end: uint) -> T[] {
+fn slice[@T](v: &[mutable? T], start: uint, end: uint) -> [T] {
     assert (start <= end);
     assert (end <= len(v));
     let result = ~[];
@@ -131,10 +131,10 @@ fn slice[@T](v: &T[mutable? ], start: uint, end: uint) -> T[] {
 }
 
 // TODO: Remove me once we have slots.
-fn slice_mut[@T](v: &T[mutable? ], start: uint, end: uint) -> T[mutable ] {
+fn slice_mut[@T](v: &[mutable? T], start: uint, end: uint) -> [mutable T] {
     assert (start <= end);
     assert (end <= len(v));
-    let result = ~[mutable ];
+    let result = ~[mutable];
     reserve(result, end - start);
     let i = start;
     while i < end { result += ~[mutable v.(i)]; i += 1u; }
@@ -145,7 +145,7 @@ fn slice_mut[@T](v: &T[mutable? ], start: uint, end: uint) -> T[mutable ] {
 // Mutators
 
 // TODO: Write this, unsafely, in a way that's not O(n).
-fn pop[@T](v: &mutable T[mutable? ]) -> T {
+fn pop[@T](v: &mutable [mutable? T]) -> T {
     let ln = len(v);
     assert (ln > 0u);
     ln -= 1u;
@@ -160,14 +160,14 @@ fn pop[@T](v: &mutable T[mutable? ]) -> T {
 // Appending
 
 /// Expands the given vector in-place by appending `n` copies of `initval`.
-fn grow[@T](v: &mutable T[], n: uint, initval: &T) {
+fn grow[@T](v: &mutable [T], n: uint, initval: &T) {
     reserve(v, next_power_of_two(len(v) + n));
     let i: uint = 0u;
     while i < n { v += ~[initval]; i += 1u; }
 }
 
 // TODO: Remove me once we have slots.
-fn grow_mut[@T](v: &mutable T[mutable ], n: uint, initval: &T) {
+fn grow_mut[@T](v: &mutable [mutable T], n: uint, initval: &T) {
     reserve(v, next_power_of_two(len(v) + n));
     let i: uint = 0u;
     while i < n { v += ~[mutable initval]; i += 1u; }
@@ -175,7 +175,7 @@ fn grow_mut[@T](v: &mutable T[mutable ], n: uint, initval: &T) {
 
 /// Calls `f` `n` times and appends the results of these calls to the given
 /// vector.
-fn grow_fn[@T](v: &mutable T[], n: uint, init_fn: fn(uint) -> T ) {
+fn grow_fn[@T](v: &mutable [T], n: uint, init_fn: fn(uint) -> T ) {
     reserve(v, next_power_of_two(len(v) + n));
     let i: uint = 0u;
     while i < n { v += ~[init_fn(i)]; i += 1u; }
@@ -184,7 +184,7 @@ fn grow_fn[@T](v: &mutable T[], n: uint, init_fn: fn(uint) -> T ) {
 /// Sets the element at position `index` to `val`. If `index` is past the end
 /// of the vector, expands the vector by replicating `initval` to fill the
 /// intervening space.
-fn grow_set[@T](v: &mutable T[mutable ], index: uint, initval: &T, val: &T) {
+fn grow_set[@T](v: &mutable [mutable T], index: uint, initval: &T, val: &T) {
     if index >= len(v) { grow_mut(v, index - len(v) + 1u, initval); }
     v.(index) = val;
 }
@@ -192,7 +192,7 @@ fn grow_set[@T](v: &mutable T[mutable ], index: uint, initval: &T, val: &T) {
 
 // Functional utilities
 
-fn map[@T, @U](f: fn(&T) -> U , v: &T[mutable? ]) -> U[] {
+fn map[@T, @U](f: fn(&T) -> U , v: &[mutable? T]) -> [U] {
     let result = ~[];
     reserve(result, len(v));
     for elem: T  in v {
@@ -202,7 +202,7 @@ fn map[@T, @U](f: fn(&T) -> U , v: &T[mutable? ]) -> U[] {
     ret result;
 }
 
-fn filter_map[@T, @U](f: fn(&T) -> option::t[U] , v: &T[mutable? ]) -> U[] {
+fn filter_map[@T, @U](f: fn(&T) -> option::t[U] , v: &[mutable? T]) -> [U] {
     let result = ~[];
     for elem: T  in v {
         let elem2 = elem; // satisfies alias checker
@@ -214,7 +214,7 @@ fn filter_map[@T, @U](f: fn(&T) -> option::t[U] , v: &T[mutable? ]) -> U[] {
     ret result;
 }
 
-fn foldl[@T, @U](p: fn(&U, &T) -> U , z: &U, v: &T[mutable? ]) -> U {
+fn foldl[@T, @U](p: fn(&U, &T) -> U , z: &U, v: &[mutable? T]) -> U {
     let sz = len(v);
     if sz == 0u { ret z; }
     let first = v.(0);
@@ -222,33 +222,33 @@ fn foldl[@T, @U](p: fn(&U, &T) -> U , z: &U, v: &T[mutable? ]) -> U {
     ret p(foldl[T, U](p, z, rest), first);
 }
 
-fn any[T](f: fn(&T) -> bool , v: &T[]) -> bool {
+fn any[T](f: fn(&T) -> bool , v: &[T]) -> bool {
     for elem: T  in v { if f(elem) { ret true; } }
     ret false;
 }
 
-fn all[T](f: fn(&T) -> bool , v: &T[]) -> bool {
+fn all[T](f: fn(&T) -> bool , v: &[T]) -> bool {
     for elem: T  in v { if !f(elem) { ret false; } }
     ret true;
 }
 
-fn member[T](x: &T, v: &T[]) -> bool {
+fn member[T](x: &T, v: &[T]) -> bool {
     for elt: T  in v { if x == elt { ret true; } }
     ret false;
 }
 
-fn count[T](x: &T, v: &T[mutable? ]) -> uint {
+fn count[T](x: &T, v: &[mutable? T]) -> uint {
     let cnt = 0u;
     for elt: T  in v { if x == elt { cnt += 1u; } }
     ret cnt;
 }
 
-fn find[@T](f: fn(&T) -> bool , v: &T[]) -> option::t[T] {
+fn find[@T](f: fn(&T) -> bool , v: &[T]) -> option::t[T] {
     for elt: T  in v { if f(elt) { ret some[T](elt); } }
     ret none[T];
 }
 
-fn unzip[@T, @U](v: &{_0: T, _1: U}[]) -> {_0: T[], _1: U[]} {
+fn unzip[@T, @U](v: &[{_0: T, _1: U}]) -> {_0: [T], _1: [U]} {
     let sz = len(v);
     if sz == 0u {
         ret {_0: ~[], _1: ~[]};
@@ -263,7 +263,7 @@ fn unzip[@T, @U](v: &{_0: T, _1: U}[]) -> {_0: T[], _1: U[]} {
 
 
 // FIXME make the lengths being equal a constraint
-fn zip[@T, @U](v: &T[], u: &U[]) -> {_0: T, _1: U}[] {
+fn zip[@T, @U](v: &[T], u: &[U]) -> [{_0: T, _1: U}] {
     let sz = len(v);
     assert (sz == len(u));
     if sz == 0u {
@@ -281,17 +281,17 @@ mod unsafe {
          heap_part: *mutable ivec_heap_part};
     type ivec_heap_part = {mutable fill: uint};
 
-    fn copy_from_buf[T](v: &mutable T[], ptr: *T, count: uint) {
+    fn copy_from_buf[T](v: &mutable [T], ptr: *T, count: uint) {
         ret rustrt::ivec_copy_from_buf_shared(v, ptr, count);
     }
 
-    fn from_buf[T](ptr: *T, bytes: uint) -> T[] {
+    fn from_buf[T](ptr: *T, bytes: uint) -> [T] {
         let v = ~[];
         copy_from_buf(v, ptr, bytes);
         ret v;
     }
 
-    fn set_len[T](v: &mutable T[], new_len: uint) {
+    fn set_len[T](v: &mutable [T], new_len: uint) {
         let new_fill = new_len * sys::size_of[T]();
         let stack_part: *mutable ivec_repr =
             ::unsafe::reinterpret_cast(addr_of(v));
index 3883d0b94e85da0947308a0f3c24fc061513a994..738adaf377f7253ca760504b11c1559c689dd270 100644 (file)
@@ -26,7 +26,7 @@ fn mk_hashmap[@K, @V](hasher: &hashfn[K], eqer: &eqfn[K]) -> hashmap[K, V] {
 
     let load_factor: util::rational = {num: 3, den: 4};
     tag bucket[@K, @V] { nil; deleted; some(K, V); }
-    fn make_buckets[@K, @V](nbkts: uint) -> (bucket[K, V])[mutable ] {
+    fn make_buckets[@K, @V](nbkts: uint) -> [mutable (bucket[K, V])] {
         ret ivec::init_elt_mut[bucket[K, V]](nil[K, V], nbkts);
     }
     // Derive two hash functions from the one given by taking the upper
@@ -55,7 +55,7 @@ fn hash(h: uint, nbkts: uint, i: uint) -> uint {
 
     fn insert_common[@K,
                      @V](hasher: &hashfn[K], eqer: &eqfn[K],
-                         bkts: &(bucket[K, V])[mutable ], nbkts: uint,
+                         bkts: &[mutable bucket[K, V]], nbkts: uint,
                          key: &K, val: &V) -> bool {
         let i: uint = 0u;
         let h: uint = hasher(key);
@@ -80,7 +80,7 @@ fn insert_common[@K,
     }
     fn find_common[@K,
                    @V](hasher: &hashfn[K], eqer: &eqfn[K],
-                       bkts: &(bucket[K, V])[mutable ], nbkts: uint, key: &K)
+                       bkts: &[mutable bucket[K, V]], nbkts: uint, key: &K)
        -> option::t[V] {
         let i: uint = 0u;
         let h: uint = hasher(key);
@@ -103,8 +103,8 @@ fn find_common[@K,
     }
     fn rehash[@K,
               @V](hasher: &hashfn[K], eqer: &eqfn[K],
-                  oldbkts: &(bucket[K, V])[mutable ], noldbkts: uint,
-                  newbkts: &(bucket[K, V])[mutable ], nnewbkts: uint) {
+                  oldbkts: &[mutable bucket[K, V]], noldbkts: uint,
+                  newbkts: &[mutable bucket[K, V]], nnewbkts: uint) {
         for b: bucket[K, V]  in oldbkts {
             alt b {
               some(k_, v_) {
@@ -119,7 +119,7 @@ fn rehash[@K,
     obj hashmap[@K,
                 @V](hasher: hashfn[K],
                     eqer: eqfn[K],
-                    mutable bkts: (bucket[K, V])[mutable ],
+                    mutable bkts: [mutable bucket[K, V]],
                     mutable nbkts: uint,
                     mutable nelts: uint,
                     lf: util::rational) {
index 8ae7e3618a800ee766e6e14c96ff3ab13bc9f95d..381a0c71755bf02d18c4f8938454efcb340db85e 100644 (file)
@@ -1,11 +1,11 @@
 
 native "rust" mod rustrt {
     fn rust_list_files(path: str) -> vec[str];
-    fn rust_list_files_ivec(path: str) -> @str[];
+    fn rust_list_files_ivec(path: str) -> @[str];
     fn rust_dirent_filename(ent: os::libc::dirent) -> str;
 }
 
-fn list_dir(path: str) -> str[] {
+fn list_dir(path: str) -> [str] {
     ret *rustrt::rust_list_files_ivec(path);
     // TODO ensure this is always closed
 
index cd633b28cca55dd8da60d4fe0cd016e5eb48d19d..ed38c757fc4f8101a375ac80a1eb7d269ccd818e 100644 (file)
     // automatically during construction
     obj {
         fn input(&vec[u8]) ;
-        fn input_ivec(&u8[]) ;
+        fn input_ivec(&[u8]) ;
         fn input_str(&str) ;
         fn result() -> vec[u8] ;
-        fn result_ivec() -> u8[] ;
+        fn result_ivec() -> [u8] ;
         fn result_str() -> str ;
         fn reset() ;
     };
 // Builds a sha1 object
 fn mk_sha1() -> sha1 {
     type sha1state =
-        {h: u32[mutable ],
+        {h: [mutable u32],
          mutable len_low: u32,
          mutable len_high: u32,
-         msg_block: u8[mutable ],
+         msg_block: [mutable u8],
          mutable msg_block_idx: uint,
          mutable computed: bool,
-         work_buf: u32[mutable ]};
+         work_buf: [mutable u32]};
 
-    fn add_input(st: &sha1state, msg: &u8[]) {
+    fn add_input(st: &sha1state, msg: &[u8]) {
         // FIXME: Should be typestate precondition
 
         assert (!st.computed);
@@ -164,9 +164,9 @@ fn process_msg_block(st: &sha1state) {
     fn circular_shift(bits: u32, word: u32) -> u32 {
         ret word << bits | word >> 32u32 - bits;
     }
-    fn mk_result(st: &sha1state) -> u8[] {
+    fn mk_result(st: &sha1state) -> [u8] {
         if !st.computed { pad_msg(st); st.computed = true; }
-        let rs: u8[] = ~[];
+        let rs: [u8] = ~[];
         for hpart: u32  in st.h {
             let a = hpart >> 24u32 & 0xFFu32 as u8;
             let b = hpart >> 16u32 & 0xFFu32 as u8;
@@ -244,7 +244,7 @@ fn input(msg: &vec[u8]) {
             for b: u8  in msg { m += ~[b]; }
             add_input(st, m);
         }
-        fn input_ivec(msg: &u8[]) { add_input(st, msg); }
+        fn input_ivec(msg: &[u8]) { add_input(st, msg); }
         fn input_str(msg: &str) { add_input(st, str::bytes_ivec(msg)); }
         fn result() -> vec[u8] {
             let rivec = mk_result(st);
@@ -252,7 +252,7 @@ fn result() -> vec[u8] {
             for b: u8  in rivec { rvec += [b]; }
             ret rvec;
         }
-        fn result_ivec() -> u8[] { ret mk_result(st); }
+        fn result_ivec() -> [u8] { ret mk_result(st); }
         fn result_str() -> str {
             let r = mk_result(st);
             let s = "";
index 1ba432c0e8f0334cd1cd2f89d090c8c370dcdc61..464c05a0340eb299660f33e6520bc3b184d5c4d4 100644 (file)
@@ -28,7 +28,7 @@ fn connect_to(ctx: ctx, ip: str, portnum: int) -> client {
     ret make_socket(ctx, p);
 }
 
-fn read(c: client) -> u8[] {
+fn read(c: client) -> [u8] {
     let evt: aio::socket_event;
     c.evt |> evt;
     alt evt {
@@ -62,7 +62,7 @@ fn accept_from(server: server) -> client {
     }
 }
 
-fn write_data(c: client, data: u8[]) -> bool {
+fn write_data(c: client, data: [u8]) -> bool {
     let p: port[bool] = port();
     c.ctx <| aio::write(c.client, data, chan(p));
     let success: bool;
index fdee322d30ee084af236e2256dbd3bd15c9844dd..abb1979b66f81b71f5d14698fec9fbed3a7b7bb5 100644 (file)
@@ -7,10 +7,10 @@
 
 // FIXME: Should not be @; there's a bug somewhere in rustc that requires this
 // to be.
-type smallintmap[T] = @{mutable v: (option::t[T])[mutable ]};
+type smallintmap[T] = @{mutable v: [mutable option::t[T]]};
 
 fn mk[@T]() -> smallintmap[T] {
-    let v: (option::t[T])[mutable ] = ~[mutable ];
+    let v: [mutable option::t[T]] = ~[mutable];
     ret @{mutable v: v};
 }
 
index 2a7348b354f10cf89df53ae6603c3e2d2c1c11d3..28592b9ca6feca9bb1f28d968895d785aac70789 100644 (file)
@@ -144,9 +144,9 @@ mod ivector {
 
     type lteq[T] = fn(&T, &T) -> bool ;
 
-    fn merge_sort[@T](le: lteq[T], v: &T[]) -> T[] {
-        fn merge[@T](le: lteq[T], a: &T[], b: &T[]) -> T[] {
-            let rs: T[] = ~[];
+    fn merge_sort[@T](le: lteq[T], v: &[T]) -> [T] {
+        fn merge[@T](le: lteq[T], a: &[T], b: &[T]) -> [T] {
+            let rs: [T] = ~[];
             let a_len: uint = ilen[T](a);
             let a_ix: uint = 0u;
             let b_len: uint = ilen[T](b);
@@ -164,18 +164,18 @@ fn merge[@T](le: lteq[T], a: &T[], b: &T[]) -> T[] {
         let v_len: uint = ilen[T](v);
         if v_len <= 1u { ret v; }
         let mid: uint = v_len / 2u;
-        let a: T[] = islice[T](v, 0u, mid);
-        let b: T[] = islice[T](v, mid, v_len);
+        let a: [T] = islice[T](v, 0u, mid);
+        let b: [T] = islice[T](v, mid, v_len);
         ret merge[T](le, merge_sort[T](le, a), merge_sort[T](le, b));
     }
 
-    fn swap[@T](arr: &T[mutable ], x: uint, y: uint) {
+    fn swap[@T](arr: &[mutable T], x: uint, y: uint) {
         let a = arr.(x);
         arr.(x) = arr.(y);
         arr.(y) = a;
     }
 
-    fn part[@T](compare_func: lteq[T], arr: &T[mutable ], left: uint,
+    fn part[@T](compare_func: lteq[T], arr: &[mutable T], left: uint,
                right: uint, pivot: uint) -> uint {
         let pivot_value = arr.(pivot);
         swap[T](arr, pivot, right);
@@ -192,7 +192,7 @@ fn part[@T](compare_func: lteq[T], arr: &T[mutable ], left: uint,
         ret storage_index;
     }
 
-    fn qsort[@T](compare_func: lteq[T], arr: &T[mutable ], left: uint,
+    fn qsort[@T](compare_func: lteq[T], arr: &[mutable T], left: uint,
                 right: uint) {
         if right > left {
             let pivot = (left + right) / 2u;
@@ -205,7 +205,7 @@ fn qsort[@T](compare_func: lteq[T], arr: &T[mutable ], left: uint,
         }
     }
 
-    fn quick_sort[@T](compare_func: lteq[T], arr: &T[mutable ]) {
+    fn quick_sort[@T](compare_func: lteq[T], arr: &[mutable T]) {
         if ilen[T](arr) == 0u { ret; }
         qsort[T](compare_func, arr, 0u, ilen[T](arr) - 1u);
     }
@@ -217,7 +217,7 @@ fn quick_sort[@T](compare_func: lteq[T], arr: &T[mutable ]) {
     // 'randomly ordered keys, abstract compare' & 'small number of key
     // values'
     fn qsort3[@T](compare_func_lt: lteq[T], compare_func_eq: lteq[T],
-                 arr: &T[mutable ], left: int, right: int) {
+                 arr: &[mutable T], left: int, right: int) {
         if right <= left { ret; }
         let v: T = arr.(right);
         let i: int = left - 1;
@@ -265,7 +265,7 @@ fn qsort3[@T](compare_func_lt: lteq[T], compare_func_eq: lteq[T],
     }
 
     fn quick_sort3[@T](compare_func_lt: lteq[T], compare_func_eq: lteq[T],
-                      arr: &T[mutable ]) {
+                      arr: &[mutable T]) {
         if ilen[T](arr) == 0u { ret; }
         qsort3[T](compare_func_lt, compare_func_eq, arr, 0,
                   (ilen[T](arr) as int) - 1);
index be76238c01ca4d739811bea7247bdc57165b3604..8a5586c3455fdf95c911826c944c319dc3151e08 100644 (file)
@@ -65,7 +65,7 @@
     fn str_vec(s: str) -> vec[u8];
     fn str_byte_len(s: str) -> uint;
     fn str_alloc(n_bytes: uint) -> str;
-    fn str_from_ivec(b: &u8[mutable? ]) -> str;
+    fn str_from_ivec(b: &[mutable? u8]) -> str;
     fn str_from_vec(b: vec[mutable? u8]) -> str;
     fn str_from_cstr(cstr: sbuf) -> str;
     fn str_from_buf(buf: sbuf, len: uint) -> str;
@@ -190,7 +190,7 @@ fn is_whitespace(s: str) -> bool {
 
 fn bytes(s: &str) -> vec[u8] { ret rustrt::str_vec(s); }
 
-fn bytes_ivec(s: str) -> u8[] {
+fn bytes_ivec(s: str) -> [u8] {
     let sbuffer = buf(s);
     let ptr = unsafe::reinterpret_cast(sbuffer);
     ret ivec::unsafe::from_buf(ptr, byte_len(s));
@@ -204,7 +204,7 @@ fn unsafe_from_bytes(v: vec[mutable? u8]) -> str {
     ret rustrt::str_from_vec(v);
 }
 
-fn unsafe_from_bytes_ivec(v: &u8[mutable? ]) -> str {
+fn unsafe_from_bytes_ivec(v: &[mutable? u8]) -> str {
     ret rustrt::str_from_ivec(v);
 }
 
@@ -463,8 +463,8 @@ fn split(s: str, sep: u8) -> vec[str] {
     ret v;
 }
 
-fn split_ivec(s: str, sep: u8) -> str[] {
-    let v: str[] = ~[];
+fn split_ivec(s: str, sep: u8) -> [str] {
+    let v: [str] = ~[];
     let accum: str = "";
     let ends_with_sep: bool = false;
     for c: u8  in s {
@@ -494,7 +494,7 @@ fn connect(v: vec[str], sep: str) -> str {
     ret s;
 }
 
-fn connect_ivec(v: &str[], sep: str) -> str {
+fn connect_ivec(v: &[str], sep: str) -> str {
     let s: str = "";
     let first: bool = true;
     for ss: str  in v {
index 753323c826446689fae95b4ce294d7d469892084..70f9580bf732dca9994e2d89aca4fd04c44a77c1 100644 (file)
@@ -48,7 +48,7 @@
 
 // The default console test runner. It accepts the command line
 // arguments and a vector of test_descs (generated at compile time).
-fn test_main(args: &vec[str], tests: &test_desc[]) {
+fn test_main(args: &vec[str], tests: &[test_desc]) {
     let ivec_args =
         { let iargs = ~[]; for arg: str  in args { iargs += ~[arg] } iargs };
     check (ivec::is_not_empty(ivec_args));
@@ -65,7 +65,7 @@ fn test_main(args: &vec[str], tests: &test_desc[]) {
 type opt_res = either::t[test_opts, str];
 
 // Parses command line arguments into test options
-fn parse_opts(args: &str[]) : ivec::is_not_empty(args) -> opt_res {
+fn parse_opts(args: &[str]) : ivec::is_not_empty(args) -> opt_res {
 
     // FIXME (#649): Shouldn't have to check here
     check (ivec::is_not_empty(args));
@@ -98,11 +98,11 @@ fn parse_opts(args: &str[]) : ivec::is_not_empty(args) -> opt_res {
 type test_to_task = fn(&fn()) -> task ;
 
 // A simple console test runner
-fn run_tests_console(opts: &test_opts, tests: &test_desc[]) -> bool {
+fn run_tests_console(opts: &test_opts, tests: &[test_desc]) -> bool {
     run_tests_console_(opts, tests, default_test_to_task)
 }
 
-fn run_tests_console_(opts: &test_opts, tests: &test_desc[],
+fn run_tests_console_(opts: &test_opts, tests: &[test_desc],
                       to_task: &test_to_task) -> bool {
 
     type test_state = @{
@@ -112,7 +112,7 @@ fn run_tests_console_(opts: &test_opts, tests: &test_desc[],
         mutable passed: uint,
         mutable failed: uint,
         mutable ignored: uint,
-        mutable failures: test_desc[]
+        mutable failures: [test_desc]
     };
 
     fn callback(event: testevent, st: test_state) {
@@ -210,12 +210,12 @@ fn use_color() -> bool {
 }
 
 tag testevent {
-    te_filtered(test_desc[]);
+    te_filtered([test_desc]);
     te_wait(test_desc);
     te_result(test_desc, test_result);
 }
 
-fn run_tests(opts: &test_opts, tests: &test_desc[],
+fn run_tests(opts: &test_opts, tests: &[test_desc],
              to_task: &test_to_task, callback: fn(testevent)) {
 
     let filtered_tests = filter_tests(opts, tests);
@@ -249,7 +249,7 @@ fn run_tests(opts: &test_opts, tests: &test_desc[],
 
 fn get_concurrency() -> uint { rustrt::sched_threads() }
 
-fn filter_tests(opts: &test_opts, tests: &test_desc[]) -> test_desc[] {
+fn filter_tests(opts: &test_opts, tests: &[test_desc]) -> [test_desc] {
     let filtered = tests;
 
     // Remove tests that don't match the test filter
index 4ec987e802f1d8680e0e491959696840a3276ef2..ab456d23b88f608fd111de55a3e57235a38edddc 100644 (file)
@@ -10,7 +10,7 @@
 
 type ufind = {mutable nodes: vec[mutable node]};
 
-fn make() -> ufind { ret {mutable nodes: [mutable ]}; }
+fn make() -> ufind { ret {mutable nodes: [mutable]}; }
 
 fn make_set(ufnd: &ufind) -> uint {
     let idx = vec::len(ufnd.nodes);
index 73daec0d773d7d35ad0b2790adfdfe7cbd5392ec..79a2811653acbe101b4eef92c8cf64b63dbefa95 100644 (file)
@@ -8,9 +8,9 @@
 // than the node itself.
 type node = option::t[uint];
 
-type ufind = {mutable nodes: node[mutable ]};
+type ufind = {mutable nodes: [mutable node]};
 
-fn make() -> ufind { ret {mutable nodes: ~[mutable ]}; }
+fn make() -> ufind { ret {mutable nodes: ~[mutable]}; }
 
 fn make_set(ufnd: &ufind) -> uint {
     let idx = ivec::len(ufnd.nodes);
index ae3d683bf68bf71fba69d03ec78026ee3b633621..cd300941df091d5923cb9d26fbd54f85048e62f7 100644 (file)
@@ -2,11 +2,11 @@
 
 native "rust" mod rustrt {
     fn rust_list_files(path: str) -> vec[str];
-    fn rust_list_files_ivec(path: str) -> @str[];
+    fn rust_list_files_ivec(path: str) -> @[str];
     fn rust_file_is_dir(path: str) -> int;
 }
 
-fn list_dir(path: str) -> str[] {
+fn list_dir(path: str) -> [str] {
     ret *rustrt::rust_list_files_ivec(path + "*");
 }