Get rid of many implicit copies as a preliminary to Issue #2448.
This commit is contained in:
parent
d89b4c8c61
commit
8668d06400
@ -603,7 +603,7 @@ fn install_uuid(c: cargo, wd: str, uuid: str) {
|
||||
for_each_package(c, { |s, p|
|
||||
info(#fmt["%s ? %s", p.uuid, uuid]);
|
||||
if p.uuid == uuid {
|
||||
vec::grow(ps, 1u, (s, p));
|
||||
vec::grow(ps, 1u, (s.name, p));
|
||||
}
|
||||
});
|
||||
if vec::len(ps) == 1u {
|
||||
@ -616,8 +616,8 @@ fn install_uuid(c: cargo, wd: str, uuid: str) {
|
||||
}
|
||||
error("Found multiple packages:");
|
||||
for ps.each {|elt|
|
||||
let (s,p) = elt;
|
||||
info(" " + s.name + "/" + p.uuid + " (" + p.name + ")");
|
||||
let (sname,p) = elt;
|
||||
info(" " + sname + "/" + p.uuid + " (" + p.name + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@ -625,7 +625,7 @@ fn install_named(c: cargo, wd: str, name: str) {
|
||||
let mut ps = [];
|
||||
for_each_package(c, { |s, p|
|
||||
if p.name == name {
|
||||
vec::grow(ps, 1u, (s, p));
|
||||
vec::grow(ps, 1u, (s.name, p));
|
||||
}
|
||||
});
|
||||
if vec::len(ps) == 1u {
|
||||
@ -638,8 +638,8 @@ fn install_named(c: cargo, wd: str, name: str) {
|
||||
}
|
||||
error("Found multiple packages:");
|
||||
for ps.each {|elt|
|
||||
let (s,p) = elt;
|
||||
info(" " + s.name + "/" + p.uuid + " (" + p.name + ")");
|
||||
let (sname,p) = elt;
|
||||
info(" " + sname + "/" + p.uuid + " (" + p.name + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ task to receive from it.
|
||||
unsafe fn chan_from_global_ptr<T: send>(
|
||||
global: global_ptr,
|
||||
builder: fn() -> task::builder,
|
||||
f: fn~(comm::port<T>)
|
||||
+f: fn~(comm::port<T>)
|
||||
) -> comm::chan<T> {
|
||||
|
||||
enum msg {
|
||||
@ -233,4 +233,4 @@ fn test_weaken_task_fail() unsafe {
|
||||
}
|
||||
};
|
||||
assert result::is_failure(res);
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ enum optval { val(str), given, }
|
||||
The result of checking command line arguments. Contains a vector
|
||||
of matches and a vector of free strings.
|
||||
"]
|
||||
type match = {opts: [opt], vals: [mut [optval]], free: [str]};
|
||||
type match = {opts: [opt], vals: [[optval]], free: [str]};
|
||||
|
||||
fn is_arg(arg: str) -> bool {
|
||||
ret str::len(arg) > 1u && arg[0] == '-' as u8;
|
||||
@ -275,7 +275,7 @@ fn getopts(args: [str], opts: [opt]) -> result unsafe {
|
||||
}
|
||||
i += 1u;
|
||||
}
|
||||
ret ok({opts: opts, vals: vals, free: free});
|
||||
ret ok({opts: opts, vals: vec::from_mut(vals), free: free});
|
||||
}
|
||||
|
||||
fn opt_vals(m: match, nm: str) -> [optval] {
|
||||
|
@ -476,7 +476,7 @@ once a new connection is recv'd. Its parameter:
|
||||
variant
|
||||
"]
|
||||
fn conn_recv_spawn(server_port: tcp_conn_port,
|
||||
cb: fn~(result::result<tcp_socket, tcp_err_data>)) {
|
||||
+cb: fn~(result::result<tcp_socket, tcp_err_data>)) {
|
||||
let new_conn_po = (**server_port).new_conn_po;
|
||||
let iotask = (**server_port).iotask;
|
||||
let new_conn_result = comm::recv(new_conn_po);
|
||||
@ -681,8 +681,8 @@ of listen exiting because of an error
|
||||
fn listen_for_conn(host_ip: ip::ip_addr, port: uint, backlog: uint,
|
||||
iotask: iotask,
|
||||
on_establish_cb: fn~(comm::chan<option<tcp_err_data>>),
|
||||
new_connect_cb: fn~(tcp_new_connection,
|
||||
comm::chan<option<tcp_err_data>>))
|
||||
+new_connect_cb: fn~(tcp_new_connection,
|
||||
comm::chan<option<tcp_err_data>>))
|
||||
-> result::result<(), tcp_err_data> unsafe {
|
||||
let stream_closed_po = comm::port::<()>();
|
||||
let kill_po = comm::port::<option<tcp_err_data>>();
|
||||
@ -773,7 +773,7 @@ Convenience methods extending `net::tcp::tcp_conn_port`
|
||||
"]
|
||||
impl conn_port_methods for tcp_conn_port {
|
||||
fn recv() -> result::result<tcp_socket, tcp_err_data> { conn_recv(self) }
|
||||
fn recv_spawn(cb: fn~(result::result<tcp_socket,tcp_err_data>))
|
||||
fn recv_spawn(+cb: fn~(result::result<tcp_socket,tcp_err_data>))
|
||||
{ conn_recv_spawn(self, cb); }
|
||||
fn peek() -> bool { conn_peek(self) }
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ fn sha1() -> sha1 {
|
||||
msg_block: [mut u8],
|
||||
mut msg_block_idx: uint,
|
||||
mut computed: bool,
|
||||
work_buf: [mut u32]};
|
||||
work_buf: @[mut u32]};
|
||||
|
||||
fn add_input(st: sha1state, msg: [u8]) {
|
||||
/* FIXME: Should be typestate precondition (#2345) */
|
||||
@ -71,7 +71,6 @@ fn sha1() -> sha1 {
|
||||
st.len_high += 1u32;
|
||||
if st.len_high == 0u32 {
|
||||
// FIXME: Need better failure mode (#2346)
|
||||
|
||||
fail;
|
||||
}
|
||||
}
|
||||
@ -81,7 +80,7 @@ fn sha1() -> sha1 {
|
||||
fn process_msg_block(st: sha1state) {
|
||||
// FIXME: Make precondition (#2345)
|
||||
assert (vec::len(st.h) == digest_buf_len);
|
||||
assert (vec::len(st.work_buf) == work_buf_len);
|
||||
assert (vec::len(*st.work_buf) == work_buf_len);
|
||||
let mut t: int; // Loop counter
|
||||
let w = st.work_buf;
|
||||
|
||||
@ -249,7 +248,7 @@ fn sha1() -> sha1 {
|
||||
msg_block: vec::to_mut(vec::from_elem(msg_block_len, 0u8)),
|
||||
mut msg_block_idx: 0u,
|
||||
mut computed: false,
|
||||
work_buf: vec::to_mut(vec::from_elem(work_buf_len, 0u32))
|
||||
work_buf: @vec::to_mut(vec::from_elem(work_buf_len, 0u32))
|
||||
};
|
||||
let sh = st as sha1;
|
||||
sh.reset();
|
||||
|
@ -58,7 +58,7 @@ fn test_main(args: [str], tests: [test_desc]) {
|
||||
}
|
||||
|
||||
type test_opts = {filter: option<str>, run_ignored: bool,
|
||||
logfile: option<str>};
|
||||
logfile: option<str>};
|
||||
|
||||
type opt_res = either<test_opts, str>;
|
||||
|
||||
@ -81,7 +81,7 @@ fn parse_opts(args: [str]) -> opt_res {
|
||||
let logfile = getopts::opt_maybe_str(match, "logfile");
|
||||
|
||||
let test_opts = {filter: filter, run_ignored: run_ignored,
|
||||
logfile: logfile};
|
||||
logfile: logfile};
|
||||
|
||||
ret either::left(test_opts);
|
||||
}
|
||||
@ -126,7 +126,7 @@ fn run_tests_console(opts: test_opts,
|
||||
st.failed += 1u;
|
||||
write_failed(st.out, st.use_color);
|
||||
st.out.write_line("");
|
||||
st.failures += [test];
|
||||
st.failures += [copy test];
|
||||
}
|
||||
tr_ignored {
|
||||
st.ignored += 1u;
|
||||
@ -273,7 +273,7 @@ fn run_tests(opts: test_opts, tests: [test_desc],
|
||||
callback: fn@(testevent)) {
|
||||
|
||||
let mut filtered_tests = filter_tests(opts, tests);
|
||||
callback(te_filtered(filtered_tests));
|
||||
callback(te_filtered(copy filtered_tests));
|
||||
|
||||
// It's tempting to just spawn all the tests at once, but since we have
|
||||
// many tests that run in other processes we would be making a big mess.
|
||||
@ -295,7 +295,7 @@ fn run_tests(opts: test_opts, tests: [test_desc],
|
||||
// We are doing one test at a time so we can print the name
|
||||
// of the test before we run it. Useful for debugging tests
|
||||
// that hang forever.
|
||||
callback(te_wait(test));
|
||||
callback(te_wait(copy test));
|
||||
}
|
||||
run_test(test, ch);
|
||||
wait_idx += 1u;
|
||||
@ -304,7 +304,7 @@ fn run_tests(opts: test_opts, tests: [test_desc],
|
||||
|
||||
let (test, result) = comm::recv(p);
|
||||
if concurrency != 1u {
|
||||
callback(te_wait(test));
|
||||
callback(te_wait(copy test));
|
||||
}
|
||||
callback(te_result(test, result));
|
||||
wait_idx -= 1u;
|
||||
@ -329,7 +329,7 @@ fn get_concurrency() -> uint {
|
||||
|
||||
fn filter_tests(opts: test_opts,
|
||||
tests: [test_desc]) -> [test_desc] {
|
||||
let mut filtered = tests;
|
||||
let mut filtered = copy tests;
|
||||
|
||||
// Remove tests that don't match the test filter
|
||||
filtered = if option::is_none(opts.filter) {
|
||||
@ -344,7 +344,7 @@ fn filter_tests(opts: test_opts,
|
||||
fn filter_fn(test: test_desc, filter_str: str) ->
|
||||
option<test_desc> {
|
||||
if str::contains(test.name, filter_str) {
|
||||
ret option::some(test);
|
||||
ret option::some(copy test);
|
||||
} else { ret option::none; }
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ fn filter_tests(opts: test_opts,
|
||||
fn filter(test: test_desc) -> option<test_desc> {
|
||||
if test.ignore {
|
||||
ret option::some({name: test.name,
|
||||
fn: test.fn,
|
||||
fn: copy test.fn,
|
||||
ignore: false,
|
||||
should_fail: test.should_fail});
|
||||
} else { ret option::none; }
|
||||
@ -385,19 +385,19 @@ type test_future = {test: test_desc, wait: fn@() -> test_result};
|
||||
|
||||
fn run_test(+test: test_desc, monitor_ch: comm::chan<monitor_msg>) {
|
||||
if test.ignore {
|
||||
comm::send(monitor_ch, (test, tr_ignored));
|
||||
comm::send(monitor_ch, (copy test, tr_ignored));
|
||||
ret;
|
||||
}
|
||||
|
||||
task::spawn {||
|
||||
let testfn = test.fn;
|
||||
let testfn = copy test.fn;
|
||||
let mut builder = task::builder();
|
||||
let result_future = task::future_result(builder);
|
||||
task::unsupervise(builder);
|
||||
task::run(builder, testfn);
|
||||
let task_result = future::get(result_future);
|
||||
let test_result = calc_result(test, task_result == task::success);
|
||||
comm::send(monitor_ch, (test, test_result));
|
||||
comm::send(monitor_ch, (copy test, test_result));
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -624,11 +624,10 @@ unsafe fn tcp_connect(connect_ptr: *uv_connect_t,
|
||||
addr_ptr: *sockaddr_in,
|
||||
++after_connect_cb: *u8)
|
||||
-> libc::c_int {
|
||||
let address = *addr_ptr;
|
||||
log(debug, #fmt("b4 native tcp_connect--addr port: %u cb: %u",
|
||||
address.sin_port as uint, after_connect_cb as uint));
|
||||
(*addr_ptr).sin_port as uint, after_connect_cb as uint));
|
||||
ret rustrt::rust_uv_tcp_connect(connect_ptr, tcp_handle_ptr,
|
||||
after_connect_cb, addr_ptr);
|
||||
after_connect_cb, addr_ptr);
|
||||
}
|
||||
// FIXME ref #2064
|
||||
unsafe fn tcp_bind(tcp_server_ptr: *uv_tcp_t,
|
||||
@ -1420,4 +1419,4 @@ mod test {
|
||||
log(debug, output);
|
||||
assert native_handle_size as uint == rust_handle_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ diagnostic emitter which records when we hit a fatal error. If the task
|
||||
fails without recording a fatal error then we've encountered a compiler
|
||||
bug and need to present an error.
|
||||
*/
|
||||
fn monitor(f: fn~(diagnostic::emitter)) {
|
||||
fn monitor(+f: fn~(diagnostic::emitter)) {
|
||||
enum monitor_msg {
|
||||
fatal,
|
||||
done,
|
||||
|
@ -552,7 +552,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
|
||||
index: @mut [entry<int>]) {
|
||||
*index += [{val: item.id, pos: ebml_w.writer.tell()}];
|
||||
}
|
||||
let add_to_index = bind add_to_index_(item, ebml_w, index);
|
||||
let add_to_index = bind add_to_index_(item, copy ebml_w, index);
|
||||
|
||||
alt item.node {
|
||||
item_const(_, _) {
|
||||
@ -796,7 +796,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
|
||||
crate_node_id, [], "");
|
||||
visit::visit_crate(*crate, (), visit::mk_vt(@{
|
||||
visit_expr: {|_e, _cx, _v|},
|
||||
visit_item: {|i, cx, v|
|
||||
visit_item: {|i, cx, v, copy ebml_w|
|
||||
visit::visit_item(i, cx, v);
|
||||
alt check ecx.tcx.items.get(i.id) {
|
||||
ast_map::node_item(_, pt) {
|
||||
@ -820,7 +820,7 @@ fn encode_info_for_items(ecx: @encode_ctxt, ebml_w: ebml::writer,
|
||||
}
|
||||
}
|
||||
},
|
||||
visit_native_item: {|ni, cx, v|
|
||||
visit_native_item: {|ni, cx, v, copy ebml_w|
|
||||
visit::visit_native_item(ni, cx, v);
|
||||
alt check ecx.tcx.items.get(ni.id) {
|
||||
ast_map::node_native_item(_, abi, pt) {
|
||||
|
@ -725,7 +725,7 @@ fn encode_side_tables_for_ii(ecx: @e::encode_ctxt,
|
||||
ebml_w: ebml::writer,
|
||||
ii: ast::inlined_item) {
|
||||
ebml_w.wr_tag(c::tag_table as uint) {||
|
||||
visit_ids(ii, fn@(id: ast::node_id) {
|
||||
visit_ids(ii, fn@(id: ast::node_id, copy ebml_w) {
|
||||
// Note: this will cause a copy of ebml_w, which is bad as
|
||||
// it has mut fields. But I believe it's harmless since
|
||||
// we generate balanced EBML.
|
||||
|
@ -1481,7 +1481,7 @@ fn lookup_in_local_mod(e: env, node_id: node_id, sp: span, id: ident,
|
||||
alt inf.index.find(id) {
|
||||
none { }
|
||||
some(lst) {
|
||||
let found = list_search(lst, bind lookup_in_mie(e, _, ns));
|
||||
let found = list_search(lst, {|x| lookup_in_mie(e, x, ns)});
|
||||
if !is_none(found) {
|
||||
ret found;
|
||||
}
|
||||
@ -1511,7 +1511,7 @@ fn lookup_in_globs(e: env, globs: [glob_imp_def], sp: span, id: ident,
|
||||
}
|
||||
}
|
||||
let matches = vec::filter_map(copy globs,
|
||||
bind lookup_in_mod_(e, _, sp, id, ns, dr));
|
||||
{|x| lookup_in_mod_(e, x, sp, id, ns, dr)});
|
||||
if vec::len(matches) == 0u {
|
||||
ret none;
|
||||
}
|
||||
|
@ -4020,7 +4020,7 @@ fn trans_stmt(cx: block, s: ast::stmt) -> block {
|
||||
|
||||
// You probably don't want to use this one. See the
|
||||
// next three functions instead.
|
||||
fn new_block(cx: fn_ctxt, parent: block_parent, kind: block_kind,
|
||||
fn new_block(cx: fn_ctxt, parent: block_parent, +kind: block_kind,
|
||||
name: str, opt_node_info: option<node_info>) -> block {
|
||||
|
||||
let s = if cx.ccx.sess.opts.save_temps || cx.ccx.sess.opts.debuginfo {
|
||||
|
@ -56,7 +56,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
|
||||
}
|
||||
|
||||
if fn_id_loc.crate != local_crate {
|
||||
let uses = vec::from_mut(cx.uses);
|
||||
let uses = vec::from_mut(copy cx.uses);
|
||||
ccx.type_use_cache.insert(fn_id, uses);
|
||||
ret uses;
|
||||
}
|
||||
@ -95,7 +95,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint)
|
||||
}
|
||||
|
||||
}
|
||||
let uses = vec::from_mut(cx.uses);
|
||||
let uses = vec::from_mut(copy cx.uses);
|
||||
ccx.type_use_cache.insert(fn_id, uses);
|
||||
uses
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ fn from_file<T>(file: str, owner: srv_owner<T>) -> T {
|
||||
run(owner, file, parse::from_file_sess)
|
||||
}
|
||||
|
||||
fn run<T>(owner: srv_owner<T>, source: str, parse: parser) -> T {
|
||||
fn run<T>(owner: srv_owner<T>, source: str, +parse: parser) -> T {
|
||||
|
||||
let srv_ = srv({
|
||||
ch: task::spawn_listener {|po|
|
||||
|
@ -90,7 +90,7 @@ fn fold_item(
|
||||
fn parse_item_attrs<T:send>(
|
||||
srv: astsrv::srv,
|
||||
id: doc::ast_id,
|
||||
parse_attrs: fn~([ast::attribute]) -> T) -> T {
|
||||
+parse_attrs: fn~([ast::attribute]) -> T) -> T {
|
||||
astsrv::exec(srv) {|ctxt|
|
||||
let attrs = alt ctxt.ast_map.get(id) {
|
||||
ast_map::node_item(item, _) { item.attrs }
|
||||
|
@ -55,18 +55,18 @@ type t<T> = {
|
||||
// initializers, but they do as function arguments
|
||||
fn mk_fold<T:copy>(
|
||||
ctxt: T,
|
||||
fold_doc: fold_doc<T>,
|
||||
fold_crate: fold_crate<T>,
|
||||
fold_item: fold_item<T>,
|
||||
fold_mod: fold_mod<T>,
|
||||
fold_nmod: fold_nmod<T>,
|
||||
fold_fn: fold_fn<T>,
|
||||
fold_const: fold_const<T>,
|
||||
fold_enum: fold_enum<T>,
|
||||
fold_res: fold_res<T>,
|
||||
fold_iface: fold_iface<T>,
|
||||
fold_impl: fold_impl<T>,
|
||||
fold_type: fold_type<T>
|
||||
+fold_doc: fold_doc<T>,
|
||||
+fold_crate: fold_crate<T>,
|
||||
+fold_item: fold_item<T>,
|
||||
+fold_mod: fold_mod<T>,
|
||||
+fold_nmod: fold_nmod<T>,
|
||||
+fold_fn: fold_fn<T>,
|
||||
+fold_const: fold_const<T>,
|
||||
+fold_enum: fold_enum<T>,
|
||||
+fold_res: fold_res<T>,
|
||||
+fold_iface: fold_iface<T>,
|
||||
+fold_impl: fold_impl<T>,
|
||||
+fold_type: fold_type<T>
|
||||
) -> fold<T> {
|
||||
fold({
|
||||
ctxt: ctxt,
|
||||
@ -177,7 +177,7 @@ fn default_any_fold_mod<T:send copy>(
|
||||
) -> doc::moddoc {
|
||||
{
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
items: par::anymap(doc.items) {|itemtag|
|
||||
items: par::anymap(doc.items) {|itemtag, copy fold|
|
||||
fold_itemtag(fold, itemtag)
|
||||
}
|
||||
with doc
|
||||
@ -203,7 +203,7 @@ fn default_par_fold_mod<T:send copy>(
|
||||
) -> doc::moddoc {
|
||||
{
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
items: par::parmap(doc.items) {|itemtag|
|
||||
items: par::parmap(doc.items) {|itemtag, copy fold|
|
||||
fold_itemtag(fold, itemtag)
|
||||
}
|
||||
with doc
|
||||
@ -216,7 +216,7 @@ fn default_any_fold_nmod<T:send copy>(
|
||||
) -> doc::nmoddoc {
|
||||
{
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
fns: par::anymap(doc.fns) {|fndoc|
|
||||
fns: par::anymap(doc.fns) {|fndoc, copy fold|
|
||||
fold.fold_fn(fold, fndoc)
|
||||
}
|
||||
with doc
|
||||
@ -242,7 +242,7 @@ fn default_par_fold_nmod<T:send copy>(
|
||||
) -> doc::nmoddoc {
|
||||
{
|
||||
item: fold.fold_item(fold, doc.item),
|
||||
fns: par::parmap(doc.fns) {|fndoc|
|
||||
fns: par::parmap(doc.fns) {|fndoc, copy fold|
|
||||
fold.fold_fn(fold, fndoc)
|
||||
}
|
||||
with doc
|
||||
|
@ -7,9 +7,9 @@ import markdown_writer::writer_factory;
|
||||
export mk_pass;
|
||||
export header_kind, header_name, header_text;
|
||||
|
||||
fn mk_pass(writer_factory: writer_factory) -> pass {
|
||||
fn mk_pass(+writer_factory: writer_factory) -> pass {
|
||||
let f = fn~(srv: astsrv::srv, doc: doc::doc) -> doc::doc {
|
||||
run(srv, doc, writer_factory)
|
||||
run(srv, doc, copy writer_factory)
|
||||
};
|
||||
|
||||
{
|
||||
@ -21,7 +21,7 @@ fn mk_pass(writer_factory: writer_factory) -> pass {
|
||||
fn run(
|
||||
srv: astsrv::srv,
|
||||
doc: doc::doc,
|
||||
writer_factory: writer_factory
|
||||
+writer_factory: writer_factory
|
||||
) -> doc::doc {
|
||||
|
||||
fn mods_last(item1: doc::itemtag, item2: doc::itemtag) -> bool {
|
||||
@ -80,7 +80,7 @@ type ctxt = {
|
||||
|
||||
fn write_markdown(
|
||||
doc: doc::doc,
|
||||
writer_factory: writer_factory
|
||||
+writer_factory: writer_factory
|
||||
) {
|
||||
par::anymap(doc.pages) {|page|
|
||||
let ctxt = {
|
||||
|
@ -136,7 +136,7 @@ fn readclose(fd: libc::c_int) -> str {
|
||||
ret buf;
|
||||
}
|
||||
|
||||
fn generic_writer(process: fn~(markdown: str)) -> writer {
|
||||
fn generic_writer(+process: fn~(markdown: str)) -> writer {
|
||||
let ch = task::spawn_listener {|po: comm::port<writeinstr>|
|
||||
let mut markdown = "";
|
||||
let mut keep_going = true;
|
||||
|
@ -13,7 +13,7 @@ fn parmap<T:send, U:send>(v: [T], f: fn~(T) -> U) -> [U] unsafe {
|
||||
let po = comm::port();
|
||||
let ch = comm::chan(po);
|
||||
let addr = ptr::addr_of(elt);
|
||||
task::spawn {||
|
||||
task::spawn {|copy f|
|
||||
comm::send(ch, f(*addr));
|
||||
}
|
||||
po
|
||||
@ -28,4 +28,4 @@ fn test_parallel_map() {
|
||||
let i = [1, 2, 3, 4];
|
||||
let j = parmap(i) {|e| e + 1 };
|
||||
assert j == [2, 3, 4, 5];
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ export item_lteq, mk_pass;
|
||||
|
||||
type item_lteq = fn~(doc::itemtag, doc::itemtag) -> bool;
|
||||
|
||||
fn mk_pass(name: str, lteq: item_lteq) -> pass {
|
||||
fn mk_pass(name: str, +lteq: item_lteq) -> pass {
|
||||
{
|
||||
name: name,
|
||||
f: fn~(srv: astsrv::srv, doc: doc::doc) -> doc::doc {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
export mk_pass;
|
||||
|
||||
fn mk_pass(name: str, op: fn~(str) -> str) -> pass {
|
||||
fn mk_pass(name: str, +op: fn~(str) -> str) -> pass {
|
||||
{
|
||||
name: name,
|
||||
f: fn~(srv: astsrv::srv, doc: doc::doc) -> doc::doc {
|
||||
@ -44,7 +44,7 @@ fn fold_item(fold: fold::fold<op>, doc: doc::itemdoc) -> doc::itemdoc {
|
||||
}
|
||||
|
||||
fn apply_to_sections(op: op, sections: [doc::section]) -> [doc::section] {
|
||||
par::anymap(sections) {|section|
|
||||
par::anymap(sections) {|section, copy op|
|
||||
{
|
||||
header: op(section.header),
|
||||
body: op(section.body)
|
||||
@ -53,13 +53,12 @@ fn apply_to_sections(op: op, sections: [doc::section]) -> [doc::section] {
|
||||
}
|
||||
|
||||
fn fold_enum(fold: fold::fold<op>, doc: doc::enumdoc) -> doc::enumdoc {
|
||||
let fold_ctxt = fold.ctxt;
|
||||
let doc = fold::default_seq_fold_enum(fold, doc);
|
||||
|
||||
{
|
||||
variants: par::anymap(doc.variants) {|variant|
|
||||
variants: par::anymap(doc.variants) {|variant, copy fold|
|
||||
{
|
||||
desc: maybe_apply_op(fold_ctxt, variant.desc)
|
||||
desc: maybe_apply_op(fold.ctxt, variant.desc)
|
||||
with variant
|
||||
}
|
||||
}
|
||||
@ -77,7 +76,7 @@ fn fold_iface(fold: fold::fold<op>, doc: doc::ifacedoc) -> doc::ifacedoc {
|
||||
}
|
||||
|
||||
fn apply_to_methods(op: op, docs: [doc::methoddoc]) -> [doc::methoddoc] {
|
||||
par::anymap(docs) {|doc|
|
||||
par::anymap(docs) {|doc, copy op|
|
||||
{
|
||||
brief: maybe_apply_op(op, doc.brief),
|
||||
desc: maybe_apply_op(op, doc.desc),
|
||||
@ -273,4 +272,4 @@ mod test {
|
||||
mk_pass("", {|s| str::trim(s)}).f(srv, doc)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,4 +49,4 @@ fn main(args: [str]) {
|
||||
let token = int::from_str(args[1]).get();
|
||||
|
||||
start(token);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user