Get rid of all of the remaining /~s in the code base.
This commit is contained in:
parent
46fba10fe8
commit
1c62f5ff74
17 changed files with 68 additions and 70 deletions
|
@ -30,8 +30,6 @@ for t in os.listdir(run_pass):
|
||||||
"xfail-fast" in s or
|
"xfail-fast" in s or
|
||||||
"xfail-win32" in s):
|
"xfail-win32" in s):
|
||||||
stage2_tests.append(t)
|
stage2_tests.append(t)
|
||||||
if "main(args: [str]/~)" in s:
|
|
||||||
take_args[t] = True
|
|
||||||
if "main(args: [str])" in s:
|
if "main(args: [str])" in s:
|
||||||
take_args[t] = True
|
take_args[t] = True
|
||||||
if "main(args: ~[str])" in s:
|
if "main(args: ~[str])" in s:
|
||||||
|
|
|
@ -32,7 +32,7 @@ export unwrap;
|
||||||
* # WARNING
|
* # WARNING
|
||||||
*
|
*
|
||||||
* For maximum performance, this type is implemented using some rather
|
* For maximum performance, this type is implemented using some rather
|
||||||
* unsafe code. In particular, this innocent looking `[mut A]/~` pointer
|
* unsafe code. In particular, this innocent looking `~[mut A]` pointer
|
||||||
* *may be null!* Therefore, it is important you not reach into the
|
* *may be null!* Therefore, it is important you not reach into the
|
||||||
* data structure manually but instead use the provided extensions.
|
* data structure manually but instead use the provided extensions.
|
||||||
*
|
*
|
||||||
|
|
|
@ -236,7 +236,7 @@ fn to_str(num: float, digits: uint) -> str {
|
||||||
* # Return value
|
* # Return value
|
||||||
*
|
*
|
||||||
* `none` if the string did not represent a valid number. Otherwise,
|
* `none` if the string did not represent a valid number. Otherwise,
|
||||||
* `some(n)` where `n` is the floating-point number represented by `[num]/~`.
|
* `some(n)` where `n` is the floating-point number represented by `[num]`.
|
||||||
*/
|
*/
|
||||||
fn from_str(num: str) -> option<float> {
|
fn from_str(num: str) -> option<float> {
|
||||||
if num == "inf" {
|
if num == "inf" {
|
||||||
|
@ -261,7 +261,7 @@ fn from_str(num: str) -> option<float> {
|
||||||
_ { ret none; }
|
_ { ret none; }
|
||||||
}
|
}
|
||||||
|
|
||||||
//Determine if first char is '-'/'+'. Set ~[pos] and ~[neg] accordingly.
|
//Determine if first char is '-'/'+'. Set [pos] and [neg] accordingly.
|
||||||
let mut neg = false; //Sign of the result
|
let mut neg = false; //Sign of the result
|
||||||
alt str::char_at(num, 0u) {
|
alt str::char_at(num, 0u) {
|
||||||
'-' {
|
'-' {
|
||||||
|
|
|
@ -247,8 +247,8 @@ impl extensions<T:copy, E:copy> for result<T,E> {
|
||||||
* if x == uint::max_value { ret err("overflow"); }
|
* if x == uint::max_value { ret err("overflow"); }
|
||||||
* else { ret ok(x+1u); }
|
* else { ret ok(x+1u); }
|
||||||
* }
|
* }
|
||||||
* map([1u, 2u, 3u]/~, inc_conditionally).chain {|incd|
|
* map(~[1u, 2u, 3u], inc_conditionally).chain {|incd|
|
||||||
* assert incd == [2u, 3u, 4u]/~;
|
* assert incd == ~[2u, 3u, 4u];
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
fn map_vec<T,U:copy,V:copy>(
|
fn map_vec<T,U:copy,V:copy>(
|
||||||
|
|
|
@ -39,7 +39,7 @@ unsafe fn bump_box_refcount<T>(+t: @T) { forget(t); }
|
||||||
*
|
*
|
||||||
* # Example
|
* # Example
|
||||||
*
|
*
|
||||||
* assert transmute("L") == [76u8, 0u8]/~;
|
* assert transmute("L") == ~[76u8, 0u8];
|
||||||
*/
|
*/
|
||||||
unsafe fn transmute<L, G>(-thing: L) -> G {
|
unsafe fn transmute<L, G>(-thing: L) -> G {
|
||||||
let newthing = reinterpret_cast(thing);
|
let newthing = reinterpret_cast(thing);
|
||||||
|
|
|
@ -666,14 +666,14 @@ pure fn filter<T: copy>(v: &[T], f: fn(T) -> bool) -> ~[T] {
|
||||||
*
|
*
|
||||||
* Flattens a vector of vectors of T into a single vector of T.
|
* Flattens a vector of vectors of T into a single vector of T.
|
||||||
*/
|
*/
|
||||||
pure fn concat<T: copy>(v: &[[T]/~]) -> ~[T] {
|
pure fn concat<T: copy>(v: &[~[T]]) -> ~[T] {
|
||||||
let mut r = ~[];
|
let mut r = ~[];
|
||||||
for each(v) |inner| { unsafe { push_all(r, inner); } }
|
for each(v) |inner| { unsafe { push_all(r, inner); } }
|
||||||
ret r;
|
ret r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Concatenate a vector of vectors, placing a given separator between each
|
/// Concatenate a vector of vectors, placing a given separator between each
|
||||||
pure fn connect<T: copy>(v: &[[T]/~], sep: T) -> ~[T] {
|
pure fn connect<T: copy>(v: &[~[T]], sep: T) -> ~[T] {
|
||||||
let mut r: ~[T] = ~[];
|
let mut r: ~[T] = ~[];
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
for each(v) |inner| {
|
for each(v) |inner| {
|
||||||
|
|
|
@ -28,21 +28,21 @@
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* fn print_usage(program: str) {
|
* fn print_usage(program: str) {
|
||||||
* io::println("Usage: " + program + " [options]/~");
|
* io::println("Usage: " + program + " [options]");
|
||||||
* io::println("-o\t\tOutput");
|
* io::println("-o\t\tOutput");
|
||||||
* io::println("-h --help\tUsage");
|
* io::println("-h --help\tUsage");
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* fn main(args: [str]/~) {
|
* fn main(args: ~[str]) {
|
||||||
* check vec::is_not_empty(args);
|
* check vec::is_not_empty(args);
|
||||||
*
|
*
|
||||||
* let program : str = vec::head(args);
|
* let program : str = vec::head(args);
|
||||||
*
|
*
|
||||||
* let opts = [
|
* let opts = ~[
|
||||||
* optopt("o"),
|
* optopt("o"),
|
||||||
* optflag("h"),
|
* optflag("h"),
|
||||||
* optflag("help")
|
* optflag("help")
|
||||||
* ]/~;
|
* ];
|
||||||
* let match = alt getopts(vec::tail(args), opts) {
|
* let match = alt getopts(vec::tail(args), opts) {
|
||||||
* result::ok(m) { m }
|
* result::ok(m) { m }
|
||||||
* result::err(f) { fail fail_str(f) }
|
* result::err(f) { fail fail_str(f) }
|
||||||
|
|
|
@ -84,12 +84,12 @@ enum ip_get_addr_err {
|
||||||
*
|
*
|
||||||
* # Returns
|
* # Returns
|
||||||
*
|
*
|
||||||
* A `result<[ip_addr]/~, ip_get_addr_err>` instance that will contain
|
* A `result<~[ip_addr], ip_get_addr_err>` instance that will contain
|
||||||
* a vector of `ip_addr` results, in the case of success, or an error
|
* a vector of `ip_addr` results, in the case of success, or an error
|
||||||
* object in the case of failure
|
* object in the case of failure
|
||||||
*/
|
*/
|
||||||
fn get_addr(++node: str, iotask: iotask)
|
fn get_addr(++node: str, iotask: iotask)
|
||||||
-> result::result<[ip_addr]/~, ip_get_addr_err> unsafe {
|
-> result::result<~[ip_addr], ip_get_addr_err> unsafe {
|
||||||
do comm::listen |output_ch| {
|
do comm::listen |output_ch| {
|
||||||
do str::unpack_slice(node) |node_ptr, len| {
|
do str::unpack_slice(node) |node_ptr, len| {
|
||||||
log(debug, #fmt("slice len %?", len));
|
log(debug, #fmt("slice len %?", len));
|
||||||
|
@ -249,7 +249,7 @@ mod v6 {
|
||||||
}
|
}
|
||||||
|
|
||||||
type get_addr_data = {
|
type get_addr_data = {
|
||||||
output_ch: comm::chan<result::result<[ip_addr]/~,ip_get_addr_err>>
|
output_ch: comm::chan<result::result<~[ip_addr],ip_get_addr_err>>
|
||||||
};
|
};
|
||||||
|
|
||||||
extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
|
extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
|
||||||
|
@ -259,7 +259,7 @@ extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
|
||||||
*get_addr_data;
|
*get_addr_data;
|
||||||
if status == 0i32 {
|
if status == 0i32 {
|
||||||
if res != (ptr::null::<addrinfo>()) {
|
if res != (ptr::null::<addrinfo>()) {
|
||||||
let mut out_vec = []/~;
|
let mut out_vec = ~[];
|
||||||
log(debug, #fmt("initial addrinfo: %?", res));
|
log(debug, #fmt("initial addrinfo: %?", res));
|
||||||
let mut curr_addr = res;
|
let mut curr_addr = res;
|
||||||
loop {
|
loop {
|
||||||
|
@ -278,7 +278,7 @@ extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
|
||||||
result::err(get_addr_unknown_error));
|
result::err(get_addr_unknown_error));
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
out_vec += [new_ip_addr]/~;
|
out_vec += ~[new_ip_addr];
|
||||||
|
|
||||||
let next_addr = ll::get_next_addrinfo(curr_addr);
|
let next_addr = ll::get_next_addrinfo(curr_addr);
|
||||||
if next_addr == ptr::null::<addrinfo>() as *addrinfo {
|
if next_addr == ptr::null::<addrinfo>() as *addrinfo {
|
||||||
|
|
|
@ -248,7 +248,7 @@ fn connect(-input_ip: ip::ip_addr, port: uint,
|
||||||
* # Arguments
|
* # Arguments
|
||||||
*
|
*
|
||||||
* * sock - a `tcp_socket` to write to
|
* * sock - a `tcp_socket` to write to
|
||||||
* * raw_write_data - a vector of `[u8]/~` that will be written to the stream.
|
* * raw_write_data - a vector of `~[u8]` that will be written to the stream.
|
||||||
* This value must remain valid for the duration of the `write` call
|
* This value must remain valid for the duration of the `write` call
|
||||||
*
|
*
|
||||||
* # Returns
|
* # Returns
|
||||||
|
@ -284,7 +284,7 @@ fn write(sock: tcp_socket, raw_write_data: ~[u8])
|
||||||
* # Arguments
|
* # Arguments
|
||||||
*
|
*
|
||||||
* * sock - a `tcp_socket` to write to
|
* * sock - a `tcp_socket` to write to
|
||||||
* * raw_write_data - a vector of `[u8]/~` that will be written to the stream.
|
* * raw_write_data - a vector of `~[u8]` that will be written to the stream.
|
||||||
* This value must remain valid for the duration of the `write` call
|
* This value must remain valid for the duration of the `write` call
|
||||||
*
|
*
|
||||||
* # Returns
|
* # Returns
|
||||||
|
@ -331,7 +331,7 @@ fn read_start(sock: tcp_socket)
|
||||||
* * `sock` - a `net::tcp::tcp_socket` that you wish to stop reading on
|
* * `sock` - a `net::tcp::tcp_socket` that you wish to stop reading on
|
||||||
*/
|
*/
|
||||||
fn read_stop(sock: tcp_socket,
|
fn read_stop(sock: tcp_socket,
|
||||||
-read_port: comm::port<result::result<[u8]/~, tcp_err_data>>) ->
|
-read_port: comm::port<result::result<~[u8], tcp_err_data>>) ->
|
||||||
result::result<(), tcp_err_data> unsafe {
|
result::result<(), tcp_err_data> unsafe {
|
||||||
log(debug, #fmt("taking the read_port out of commission %?", read_port));
|
log(debug, #fmt("taking the read_port out of commission %?", read_port));
|
||||||
let socket_data = ptr::addr_of(*sock.socket_data);
|
let socket_data = ptr::addr_of(*sock.socket_data);
|
||||||
|
@ -360,7 +360,7 @@ fn read(sock: tcp_socket, timeout_msecs: uint)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a single chunk of data; returns a `future::future<[u8]/~>`
|
* Reads a single chunk of data; returns a `future::future<~[u8]>`
|
||||||
* immediately
|
* immediately
|
||||||
*
|
*
|
||||||
* Does a non-blocking read operation for a single chunk of data from a
|
* Does a non-blocking read operation for a single chunk of data from a
|
||||||
|
@ -731,7 +731,7 @@ fn listen_common(-host_ip: ip::ip_addr, port: uint, backlog: uint,
|
||||||
* A buffered wrapper that you can cast as an `io::reader` or `io::writer`
|
* A buffered wrapper that you can cast as an `io::reader` or `io::writer`
|
||||||
*/
|
*/
|
||||||
fn socket_buf(-sock: tcp_socket) -> tcp_socket_buf {
|
fn socket_buf(-sock: tcp_socket) -> tcp_socket_buf {
|
||||||
tcp_socket_buf(@{ sock: sock, mut buf: []/~ })
|
tcp_socket_buf(@{ sock: sock, mut buf: ~[] })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convenience methods extending `net::tcp::tcp_socket`
|
/// Convenience methods extending `net::tcp::tcp_socket`
|
||||||
|
@ -741,7 +741,7 @@ impl tcp_socket for tcp_socket {
|
||||||
read_start(self)
|
read_start(self)
|
||||||
}
|
}
|
||||||
fn read_stop(-read_port:
|
fn read_stop(-read_port:
|
||||||
comm::port<result::result<[u8]/~, tcp_err_data>>) ->
|
comm::port<result::result<~[u8], tcp_err_data>>) ->
|
||||||
result::result<(), tcp_err_data> {
|
result::result<(), tcp_err_data> {
|
||||||
read_stop(self, read_port)
|
read_stop(self, read_port)
|
||||||
}
|
}
|
||||||
|
@ -765,14 +765,14 @@ impl tcp_socket for tcp_socket {
|
||||||
|
|
||||||
/// Implementation of `io::reader` iface for a buffered `net::tcp::tcp_socket`
|
/// Implementation of `io::reader` iface for a buffered `net::tcp::tcp_socket`
|
||||||
impl tcp_socket_buf of io::reader for @tcp_socket_buf {
|
impl tcp_socket_buf of io::reader for @tcp_socket_buf {
|
||||||
fn read_bytes(amt: uint) -> [u8]/~ {
|
fn read_bytes(amt: uint) -> ~[u8] {
|
||||||
let has_amt_available =
|
let has_amt_available =
|
||||||
vec::len((*(self.data)).buf) >= amt;
|
vec::len((*(self.data)).buf) >= amt;
|
||||||
if has_amt_available {
|
if has_amt_available {
|
||||||
// no arbitrary-length shift in vec::?
|
// no arbitrary-length shift in vec::?
|
||||||
let mut ret_buf = []/~;
|
let mut ret_buf = ~[];
|
||||||
while vec::len(ret_buf) < amt {
|
while vec::len(ret_buf) < amt {
|
||||||
ret_buf += [vec::shift((*(self.data)).buf)]/~;
|
ret_buf += ~[vec::shift((*(self.data)).buf)];
|
||||||
}
|
}
|
||||||
ret_buf
|
ret_buf
|
||||||
}
|
}
|
||||||
|
@ -782,7 +782,7 @@ impl tcp_socket_buf of io::reader for @tcp_socket_buf {
|
||||||
let err_data = read_result.get_err();
|
let err_data = read_result.get_err();
|
||||||
log(debug, #fmt("ERROR sock_buf as io::reader.read err %? %?",
|
log(debug, #fmt("ERROR sock_buf as io::reader.read err %? %?",
|
||||||
err_data.err_name, err_data.err_msg));
|
err_data.err_name, err_data.err_msg));
|
||||||
[]/~
|
~[]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let new_chunk = result::unwrap(read_result);
|
let new_chunk = result::unwrap(read_result);
|
||||||
|
@ -811,7 +811,7 @@ impl tcp_socket_buf of io::reader for @tcp_socket_buf {
|
||||||
|
|
||||||
/// Implementation of `io::reader` iface for a buffered `net::tcp::tcp_socket`
|
/// Implementation of `io::reader` iface for a buffered `net::tcp::tcp_socket`
|
||||||
impl tcp_socket_buf of io::writer for @tcp_socket_buf {
|
impl tcp_socket_buf of io::writer for @tcp_socket_buf {
|
||||||
fn write(data: [const u8]/&) unsafe {
|
fn write(data: &[const u8]) unsafe {
|
||||||
let socket_data_ptr =
|
let socket_data_ptr =
|
||||||
ptr::addr_of(*((*(self.data)).sock).socket_data);
|
ptr::addr_of(*((*(self.data)).sock).socket_data);
|
||||||
let w_result = write_common_impl(socket_data_ptr,
|
let w_result = write_common_impl(socket_data_ptr,
|
||||||
|
@ -1221,7 +1221,7 @@ type tcp_socket_data = {
|
||||||
|
|
||||||
type tcp_buffered_socket_data = {
|
type tcp_buffered_socket_data = {
|
||||||
sock: tcp_socket,
|
sock: tcp_socket,
|
||||||
mut buf: [u8]/~
|
mut buf: ~[u8]
|
||||||
};
|
};
|
||||||
|
|
||||||
//#[cfg(test)]
|
//#[cfg(test)]
|
||||||
|
|
|
@ -146,7 +146,7 @@ fn qsort3<T: copy>(compare_func_lt: le<T>, compare_func_eq: le<T>,
|
||||||
/**
|
/**
|
||||||
* Fancy quicksort. Sorts a mut vector in place.
|
* Fancy quicksort. Sorts a mut vector in place.
|
||||||
*
|
*
|
||||||
* Based on algorithm presented by [Sedgewick and Bentley]/~
|
* Based on algorithm presented by ~[Sedgewick and Bentley]
|
||||||
* (http://www.cs.princeton.edu/~rs/talks/QuicksortIsOptimal.pdf).
|
* (http://www.cs.princeton.edu/~rs/talks/QuicksortIsOptimal.pdf).
|
||||||
* According to these slides this is the algorithm of choice for
|
* According to these slides this is the algorithm of choice for
|
||||||
* 'randomly ordered keys, abstract compare' & 'small number of key values'.
|
* 'randomly ordered keys, abstract compare' & 'small number of key values'.
|
||||||
|
|
|
@ -23,7 +23,7 @@ const color_bright_magenta: u8 = 13u8;
|
||||||
const color_bright_cyan: u8 = 14u8;
|
const color_bright_cyan: u8 = 14u8;
|
||||||
const color_bright_white: u8 = 15u8;
|
const color_bright_white: u8 = 15u8;
|
||||||
|
|
||||||
fn esc(writer: io::writer) { writer.write([0x1bu8, '[' as u8]/~); }
|
fn esc(writer: io::writer) { writer.write(~[0x1bu8, '[' as u8]); }
|
||||||
|
|
||||||
/// Reset the foreground and background colors to default
|
/// Reset the foreground and background colors to default
|
||||||
fn reset(writer: io::writer) {
|
fn reset(writer: io::writer) {
|
||||||
|
|
|
@ -819,8 +819,8 @@ unsafe fn ip6_addr(ip: str, port: int)
|
||||||
}
|
}
|
||||||
unsafe fn ip4_name(src: &sockaddr_in) -> str {
|
unsafe fn ip4_name(src: &sockaddr_in) -> str {
|
||||||
// ipv4 addr max size: 15 + 1 trailing null byte
|
// ipv4 addr max size: 15 + 1 trailing null byte
|
||||||
let dst: [u8]/~ = [0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
let dst: ~[u8] = ~[0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
||||||
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8]/~;
|
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8];
|
||||||
let size = 16 as libc::size_t;
|
let size = 16 as libc::size_t;
|
||||||
do vec::as_buf(dst) |dst_buf| {
|
do vec::as_buf(dst) |dst_buf| {
|
||||||
rustrt::rust_uv_ip4_name(src as *sockaddr_in,
|
rustrt::rust_uv_ip4_name(src as *sockaddr_in,
|
||||||
|
@ -836,12 +836,12 @@ unsafe fn ip4_name(src: &sockaddr_in) -> str {
|
||||||
}
|
}
|
||||||
unsafe fn ip6_name(src: &sockaddr_in6) -> str {
|
unsafe fn ip6_name(src: &sockaddr_in6) -> str {
|
||||||
// ipv6 addr max size: 45 + 1 trailing null byte
|
// ipv6 addr max size: 45 + 1 trailing null byte
|
||||||
let dst: [u8]/~ = [0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
let dst: ~[u8] = ~[0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
||||||
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
||||||
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
||||||
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
||||||
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
0u8,0u8,0u8,0u8,0u8,0u8,0u8,0u8,
|
||||||
0u8,0u8,0u8,0u8,0u8,0u8]/~;
|
0u8,0u8,0u8,0u8,0u8,0u8];
|
||||||
let size = 46 as libc::size_t;
|
let size = 46 as libc::size_t;
|
||||||
do vec::as_buf(dst) |dst_buf| {
|
do vec::as_buf(dst) |dst_buf| {
|
||||||
let src_unsafe_ptr = src as *sockaddr_in6;
|
let src_unsafe_ptr = src as *sockaddr_in6;
|
||||||
|
|
|
@ -162,7 +162,7 @@ impl methods for state {
|
||||||
cx.ty_path(path(self.name).add_tys(cx.ty_vars(self.ty_params)))
|
cx.ty_path(path(self.name).add_tys(cx.ty_vars(self.ty_params)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_type_decls(cx: ext_ctxt) -> [@ast::item]/~ {
|
fn to_type_decls(cx: ext_ctxt) -> ~[@ast::item] {
|
||||||
// This compiles into two different type declarations. Say the
|
// This compiles into two different type declarations. Say the
|
||||||
// state is called ping. This will generate both `ping` and
|
// state is called ping. This will generate both `ping` and
|
||||||
// `ping_message`. The first contains data that the user cares
|
// `ping_message`. The first contains data that the user cares
|
||||||
|
@ -171,7 +171,7 @@ impl methods for state {
|
||||||
|
|
||||||
let name = self.data_name();
|
let name = self.data_name();
|
||||||
|
|
||||||
let mut items_msg = []/~;
|
let mut items_msg = ~[];
|
||||||
|
|
||||||
for self.messages.each |m| {
|
for self.messages.each |m| {
|
||||||
let message(_, tys, this, next, next_tys) = m;
|
let message(_, tys, this, next, next_tys) = m;
|
||||||
|
@ -197,7 +197,7 @@ impl methods for state {
|
||||||
~[cx.item_enum_poly(name, items_msg, self.ty_params)]
|
~[cx.item_enum_poly(name, items_msg, self.ty_params)]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_endpoint_decls(cx: ext_ctxt, dir: direction) -> [@ast::item]/~ {
|
fn to_endpoint_decls(cx: ext_ctxt, dir: direction) -> ~[@ast::item] {
|
||||||
let dir = alt dir {
|
let dir = alt dir {
|
||||||
send { (*self).dir }
|
send { (*self).dir }
|
||||||
recv { (*self).dir.reverse() }
|
recv { (*self).dir.reverse() }
|
||||||
|
@ -285,7 +285,7 @@ impl methods for protocol {
|
||||||
start_state.to_ty(cx).to_source(),
|
start_state.to_ty(cx).to_source(),
|
||||||
body.to_source()),
|
body.to_source()),
|
||||||
cx.cfg(),
|
cx.cfg(),
|
||||||
[]/~,
|
~[],
|
||||||
ast::public,
|
ast::public,
|
||||||
cx.parse_sess()).get()
|
cx.parse_sess()).get()
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ impl of to_source for @ast::item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl of to_source for [@ast::item]/~ {
|
impl of to_source for ~[@ast::item] {
|
||||||
fn to_source() -> str {
|
fn to_source() -> str {
|
||||||
str::connect(self.map(|i| i.to_source()), "\n\n")
|
str::connect(self.map(|i| i.to_source()), "\n\n")
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ impl of to_source for @ast::ty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl of to_source for [@ast::ty]/~ {
|
impl of to_source for ~[@ast::ty] {
|
||||||
fn to_source() -> str {
|
fn to_source() -> str {
|
||||||
str::connect(self.map(|i| i.to_source()), ", ")
|
str::connect(self.map(|i| i.to_source()), ", ")
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ impl parse_utils for ext_ctxt {
|
||||||
"***protocol expansion***",
|
"***protocol expansion***",
|
||||||
@(copy s),
|
@(copy s),
|
||||||
self.cfg(),
|
self.cfg(),
|
||||||
[]/~,
|
~[],
|
||||||
ast::public,
|
ast::public,
|
||||||
self.parse_sess());
|
self.parse_sess());
|
||||||
alt res {
|
alt res {
|
||||||
|
@ -382,13 +382,13 @@ impl parse_utils for ext_ctxt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl methods<A: copy, B: copy> for ([A]/~, [B]/~) {
|
impl methods<A: copy, B: copy> for (~[A], ~[B]) {
|
||||||
fn zip() -> [(A, B)]/~ {
|
fn zip() -> ~[(A, B)] {
|
||||||
let (a, b) = self;
|
let (a, b) = self;
|
||||||
vec::zip(a, b)
|
vec::zip(a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn map<C>(f: fn(A, B) -> C) -> [C]/~ {
|
fn map<C>(f: fn(A, B) -> C) -> ~[C] {
|
||||||
let (a, b) = self;
|
let (a, b) = self;
|
||||||
vec::map2(a, b, f)
|
vec::map2(a, b, f)
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl parser_attr for parser {
|
||||||
if self.look_ahead(1u) != token::LBRACKET {
|
if self.look_ahead(1u) != token::LBRACKET {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
attrs += [self.parse_attribute(ast::attr_outer)]/~;
|
attrs += ~[self.parse_attribute(ast::attr_outer)];
|
||||||
}
|
}
|
||||||
token::DOC_COMMENT(s) {
|
token::DOC_COMMENT(s) {
|
||||||
let attr = ::attr::mk_sugared_doc_attr(
|
let attr = ::attr::mk_sugared_doc_attr(
|
||||||
|
@ -58,7 +58,7 @@ impl parser_attr for parser {
|
||||||
if attr.node.style != ast::attr_outer {
|
if attr.node.style != ast::attr_outer {
|
||||||
self.fatal("expected outer comment");
|
self.fatal("expected outer comment");
|
||||||
}
|
}
|
||||||
attrs += [attr]/~;
|
attrs += ~[attr];
|
||||||
self.bump();
|
self.bump();
|
||||||
}
|
}
|
||||||
_ {
|
_ {
|
||||||
|
@ -105,14 +105,14 @@ impl parser_attr for parser {
|
||||||
let attr = self.parse_attribute(ast::attr_inner);
|
let attr = self.parse_attribute(ast::attr_inner);
|
||||||
if self.token == token::SEMI {
|
if self.token == token::SEMI {
|
||||||
self.bump();
|
self.bump();
|
||||||
inner_attrs += [attr]/~;
|
inner_attrs += ~[attr];
|
||||||
} else {
|
} else {
|
||||||
// It's not really an inner attribute
|
// It's not really an inner attribute
|
||||||
let outer_attr =
|
let outer_attr =
|
||||||
spanned(attr.span.lo, attr.span.hi,
|
spanned(attr.span.lo, attr.span.hi,
|
||||||
{style: ast::attr_outer, value: attr.node.value,
|
{style: ast::attr_outer, value: attr.node.value,
|
||||||
is_sugared_doc: false});
|
is_sugared_doc: false});
|
||||||
next_outer_attrs += [outer_attr]/~;
|
next_outer_attrs += ~[outer_attr];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,9 +121,9 @@ impl parser_attr for parser {
|
||||||
*self.get_str(s), self.span.lo, self.span.hi);
|
*self.get_str(s), self.span.lo, self.span.hi);
|
||||||
self.bump();
|
self.bump();
|
||||||
if attr.node.style == ast::attr_inner {
|
if attr.node.style == ast::attr_inner {
|
||||||
inner_attrs += [attr]/~;
|
inner_attrs += ~[attr];
|
||||||
} else {
|
} else {
|
||||||
next_outer_attrs += [attr]/~;
|
next_outer_attrs += ~[attr];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ fn doc_comment_style(comment: str) -> ast::attr_style {
|
||||||
fn strip_doc_comment_decoration(comment: str) -> str {
|
fn strip_doc_comment_decoration(comment: str) -> str {
|
||||||
|
|
||||||
/// remove whitespace-only lines from the start/end of lines
|
/// remove whitespace-only lines from the start/end of lines
|
||||||
fn vertical_trim(lines: [str]/~) -> [str]/~ {
|
fn vertical_trim(lines: ~[str]) -> ~[str] {
|
||||||
let mut i = 0u, j = lines.len();
|
let mut i = 0u, j = lines.len();
|
||||||
while i < j && lines[i].trim().is_empty() {
|
while i < j && lines[i].trim().is_empty() {
|
||||||
i += 1u;
|
i += 1u;
|
||||||
|
@ -51,7 +51,7 @@ fn strip_doc_comment_decoration(comment: str) -> str {
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop leftmost columns that contain only values in chars
|
// drop leftmost columns that contain only values in chars
|
||||||
fn block_trim(lines: [str]/~, chars: str, max: option<uint>) -> [str]/~ {
|
fn block_trim(lines: ~[str], chars: str, max: option<uint>) -> ~[str] {
|
||||||
|
|
||||||
let mut i = max.get_default(uint::max_value);
|
let mut i = max.get_default(uint::max_value);
|
||||||
for lines.each |line| {
|
for lines.each |line| {
|
||||||
|
@ -136,7 +136,7 @@ fn consume_whitespace_counting_blank_lines(rdr: string_reader,
|
||||||
|
|
||||||
|
|
||||||
fn read_shebang_comment(rdr: string_reader, code_to_the_left: bool,
|
fn read_shebang_comment(rdr: string_reader, code_to_the_left: bool,
|
||||||
&comments: [cmnt]/~) {
|
&comments: ~[cmnt]) {
|
||||||
#debug(">>> shebang comment");
|
#debug(">>> shebang comment");
|
||||||
let p = rdr.chpos;
|
let p = rdr.chpos;
|
||||||
#debug("<<< shebang comment");
|
#debug("<<< shebang comment");
|
||||||
|
@ -148,7 +148,7 @@ fn read_shebang_comment(rdr: string_reader, code_to_the_left: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_line_comments(rdr: string_reader, code_to_the_left: bool,
|
fn read_line_comments(rdr: string_reader, code_to_the_left: bool,
|
||||||
&comments: [cmnt]/~) {
|
&comments: ~[cmnt]) {
|
||||||
#debug(">>> line comments");
|
#debug(">>> line comments");
|
||||||
let p = rdr.chpos;
|
let p = rdr.chpos;
|
||||||
let mut lines: ~[str] = ~[];
|
let mut lines: ~[str] = ~[];
|
||||||
|
@ -191,7 +191,7 @@ fn trim_whitespace_prefix_and_push_line(&lines: ~[str],
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_block_comment(rdr: string_reader, code_to_the_left: bool,
|
fn read_block_comment(rdr: string_reader, code_to_the_left: bool,
|
||||||
&comments: [cmnt]/~) {
|
&comments: ~[cmnt]) {
|
||||||
#debug(">>> block comment");
|
#debug(">>> block comment");
|
||||||
let p = rdr.chpos;
|
let p = rdr.chpos;
|
||||||
let mut lines: ~[str] = ~[];
|
let mut lines: ~[str] = ~[];
|
||||||
|
|
|
@ -52,11 +52,11 @@ fn thread_ring(i: uint,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main(args: [str]/~) {
|
fn main(args: ~[str]) {
|
||||||
let args = if os::getenv("RUST_BENCH").is_some() {
|
let args = if os::getenv("RUST_BENCH").is_some() {
|
||||||
["", "100", "10000"]/~
|
~["", "100", "10000"]
|
||||||
} else if args.len() <= 1u {
|
} else if args.len() <= 1u {
|
||||||
["", "100", "1000"]/~
|
~["", "100", "1000"]
|
||||||
} else {
|
} else {
|
||||||
copy args
|
copy args
|
||||||
};
|
};
|
||||||
|
@ -70,7 +70,7 @@ fn main(args: [str]/~) {
|
||||||
let start = time::precise_time_s();
|
let start = time::precise_time_s();
|
||||||
|
|
||||||
// create the ring
|
// create the ring
|
||||||
let mut futures = []/~;
|
let mut futures = ~[];
|
||||||
|
|
||||||
for uint::range(1u, num_tasks) |i| {
|
for uint::range(1u, num_tasks) |i| {
|
||||||
//#error("spawning %?", i);
|
//#error("spawning %?", i);
|
||||||
|
@ -78,7 +78,7 @@ fn main(args: [str]/~) {
|
||||||
let num_chan2 = ~mut none;
|
let num_chan2 = ~mut none;
|
||||||
*num_chan2 <-> num_chan;
|
*num_chan2 <-> num_chan;
|
||||||
let num_port = ~mut some(num_port);
|
let num_port = ~mut some(num_port);
|
||||||
futures += [future::spawn(|move num_chan2, move num_port| {
|
futures += ~[future::spawn(|move num_chan2, move num_port| {
|
||||||
let mut num_chan = none;
|
let mut num_chan = none;
|
||||||
num_chan <-> *num_chan2;
|
num_chan <-> *num_chan2;
|
||||||
let mut num_port1 = none;
|
let mut num_port1 = none;
|
||||||
|
@ -86,7 +86,7 @@ fn main(args: [str]/~) {
|
||||||
thread_ring(i, msg_per_task,
|
thread_ring(i, msg_per_task,
|
||||||
option::unwrap(num_chan),
|
option::unwrap(num_chan),
|
||||||
option::unwrap(num_port1))
|
option::unwrap(num_port1))
|
||||||
})]/~;
|
})];
|
||||||
num_chan = some(new_chan);
|
num_chan = some(new_chan);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -254,23 +254,23 @@ impl ptr_visitor<V: ty_visitor movable_ptr>
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_evec_box(mtbl: uint, inner: *tydesc) -> bool {
|
fn visit_evec_box(mtbl: uint, inner: *tydesc) -> bool {
|
||||||
self.align_to::<[u8]/@>();
|
self.align_to::<@[u8]>();
|
||||||
if ! self.inner.visit_evec_box(mtbl, inner) { ret false; }
|
if ! self.inner.visit_evec_box(mtbl, inner) { ret false; }
|
||||||
self.bump_past::<[u8]/@>();
|
self.bump_past::<@[u8]>();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_evec_uniq(mtbl: uint, inner: *tydesc) -> bool {
|
fn visit_evec_uniq(mtbl: uint, inner: *tydesc) -> bool {
|
||||||
self.align_to::<[u8]/~>();
|
self.align_to::<~[u8]>();
|
||||||
if ! self.inner.visit_evec_uniq(mtbl, inner) { ret false; }
|
if ! self.inner.visit_evec_uniq(mtbl, inner) { ret false; }
|
||||||
self.bump_past::<[u8]/~>();
|
self.bump_past::<~[u8]>();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_evec_slice(mtbl: uint, inner: *tydesc) -> bool {
|
fn visit_evec_slice(mtbl: uint, inner: *tydesc) -> bool {
|
||||||
self.align_to::<[u8]/&static>();
|
self.align_to::<&static.[u8]>();
|
||||||
if ! self.inner.visit_evec_slice(mtbl, inner) { ret false; }
|
if ! self.inner.visit_evec_slice(mtbl, inner) { ret false; }
|
||||||
self.bump_past::<[u8]/&static>();
|
self.bump_past::<&static.[u8]>();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue