test: Fix compilation of benchmarks for moves-based-on-type. rs=bustage

This commit is contained in:
Patrick Walton 2012-12-06 15:56:52 -08:00
parent 4055001388
commit 9750763a70
8 changed files with 16 additions and 14 deletions

View file

@ -407,7 +407,7 @@ fn main() {
vec::len(edges), stop - start));
let start = time::precise_time_s();
let graph = make_graph(1 << scale, edges);
let graph = make_graph(1 << scale, copy edges);
let stop = time::precise_time_s();
let mut total_edges = 0;

View file

@ -36,7 +36,7 @@ fn select_random(r: u32, genelist: ~[aminoacids]) -> char {
} else { return bisect(v, mid, hi, target); }
} else { return v[hi].ch; }
}
return bisect(genelist, 0u, vec::len::<aminoacids>(genelist) - 1u, r);
return bisect(copy genelist, 0, vec::len::<aminoacids>(genelist) - 1, r);
}
fn make_random_fasta(wr: io::Writer, id: ~str, desc: ~str, genelist: ~[aminoacids], n: int) {

View file

@ -25,7 +25,7 @@ fn main() {
};
let n = int::from_str(args[1]).get();
let bodies: ~[Body::props] = NBodySystem::make();
io::println(fmt!("%f", NBodySystem::energy(bodies)));
io::println(fmt!("%f", NBodySystem::energy(copy bodies)));
let mut i = 0;
while i < n { NBodySystem::advance(bodies, 0.01); i += 1; }
io::println(fmt!("%f", NBodySystem::energy(bodies)));

View file

@ -90,7 +90,7 @@ fn main() {
args
};
let opts = parse_opts(args);
let opts = parse_opts(copy args);
if opts.stress {
stress(2);

View file

@ -6,7 +6,7 @@ fn eval_A(i: uint, j: uint) -> float {
1.0/(((i+j)*(i+j+1u)/2u+i+1u) as float)
}
fn eval_A_times_u(u: ~[const float], Au: ~[mut float]) {
fn eval_A_times_u(u: &[const float], Au: &[mut float]) {
let N = vec::len(u);
let mut i = 0u;
while i < N {
@ -20,7 +20,7 @@ fn eval_A_times_u(u: ~[const float], Au: ~[mut float]) {
}
}
fn eval_At_times_u(u: ~[const float], Au: ~[mut float]) {
fn eval_At_times_u(u: &[const float], Au: &[mut float]) {
let N = vec::len(u);
let mut i = 0u;
while i < N {
@ -34,7 +34,7 @@ fn eval_At_times_u(u: ~[const float], Au: ~[mut float]) {
}
}
fn eval_AtA_times_u(u: ~[const float], AtAu: ~[mut float]) {
fn eval_AtA_times_u(u: &[const float], AtAu: &[mut float]) {
let v = vec::to_mut(vec::from_elem(vec::len(u), 0.0));
eval_A_times_u(u, v);
eval_At_times_u(v, AtAu);

View file

@ -56,7 +56,7 @@ fn solve_grid(g: grid_t) {
}
// drop colors already in use in neighbourhood
drop_colors(g, avail, row, col);
drop_colors(copy g, copy avail, row, col);
// find first remaining color that is available
for uint::range(1u, 10u) |i| {
@ -77,7 +77,7 @@ fn solve_grid(g: grid_t) {
if color != 0u8 { colors.set(color as uint, false); }
}
let it = |a,b| drop_color(g, avail, a, b);
let it = |a,b| drop_color(copy g, copy avail, a, b);
for u8::range(0u8, 9u8) |idx| {
it(idx, col); /* check same column fields */
@ -105,7 +105,7 @@ fn solve_grid(g: grid_t) {
while (ptr < end) {
let (row, col) = work[ptr];
// is there another color to try?
if next_color(*g, row, col, (*g)[row][col] + (1 as u8)) {
if next_color(copy *g, row, col, (*g)[row][col] + (1 as u8)) {
// yes: advance work list
ptr = ptr + 1u;
} else {
@ -163,7 +163,7 @@ fn main() {
} else {
read_grid(io::stdin())
};
solve_grid(grid);
solve_grid(copy grid);
write_grid(io::stdout(), grid);
}

View file

@ -75,7 +75,7 @@ fn recurse_or_fail(depth: int, st: Option<st>) {
}
Some(st) => {
let fn_box = st.fn_box;
let fn_unique = st.fn_unique;
let fn_unique = copy st.fn_unique;
st_({
box: @Cons((), st.box),

View file

@ -270,8 +270,10 @@ mod map_reduce {
// log(error, "creating new reducer for " + k);
let p = Port();
let ch = Chan(&p);
let r = reduce, kk = k;
tasks.push(spawn_joinable(|move r| reduce_task(~r, kk, ch) ));
let r = copy reduce, kk = k;
tasks.push(spawn_joinable(|move r|
reduce_task(~copy r, kk, ch)
));
c = recv(p);
reducers.insert(k, c);
}