e08a805b30
Conflicts: src/libsyntax/parse/parser.rs src/test/bench/graph500-bfs.rs src/test/bench/sudoku.rs src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs src/test/run-pass/empty-mutable-vec.rs src/test/run-pass/foreach-nested.rs src/test/run-pass/swap-2.rs
20 lines
270 B
Rust
20 lines
270 B
Rust
pure fn sum(x: &[int]) -> int {
|
|
let mut sum = 0;
|
|
for x.each |y| { sum += *y; }
|
|
return sum;
|
|
}
|
|
|
|
fn sum_mut(y: &mut [int]) -> int {
|
|
sum(y)
|
|
}
|
|
|
|
fn sum_imm(y: &[int]) -> int {
|
|
sum(y)
|
|
}
|
|
|
|
fn sum_const(y: &[const int]) -> int {
|
|
sum(y)
|
|
}
|
|
|
|
pub fn main() {}
|