rust/src/test/run-pass/coerce-reborrow-imm-vec-arg.rs

22 lines
293 B
Rust
Raw Normal View History

fn sum(x: &[int]) -> int {
let mut sum = 0;
2013-06-22 14:43:15 -04:00
for x.iter().advance |y| { sum += *y; }
return sum;
}
fn sum_mut(y: &mut [int]) -> int {
sum(y)
}
fn sum_imm(y: &[int]) -> int {
sum(y)
}
2013-06-22 14:43:15 -04:00
/* FIXME #7304
fn sum_const(y: &const [int]) -> int {
sum(y)
}
2013-06-22 14:43:15 -04:00
*/
pub fn main() {}