2012-06-29 16:26:56 -07:00
|
|
|
fn want_slice(v: &[int]) -> int {
|
2012-05-31 14:02:39 -07:00
|
|
|
let mut sum = 0;
|
|
|
|
for vec::each(v) { |i| sum += i; }
|
|
|
|
ret sum;
|
|
|
|
}
|
|
|
|
|
2012-06-29 16:26:56 -07:00
|
|
|
fn has_mut_vec(+v: ~[mut int]) -> int {
|
2012-05-31 14:02:39 -07:00
|
|
|
want_slice(v)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2012-06-29 16:26:56 -07:00
|
|
|
assert has_mut_vec(~[mut 1, 2, 3]) == 6;
|
2012-05-31 14:02:39 -07:00
|
|
|
}
|