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

22 lines
290 B
Rust
Raw Normal View History

fn sum(x: &[int]) -> int {
let mut sum = 0;
2013-08-01 02:16:42 -05:00
foreach y in x.iter() { sum += *y; }
return sum;
}
fn sum_mut(y: &mut [int]) -> int {
sum(y)
}
fn sum_imm(y: &[int]) -> int {
sum(y)
}
2013-06-22 13:43:15 -05:00
/* FIXME #7304
fn sum_const(y: &const [int]) -> int {
sum(y)
}
2013-06-22 13:43:15 -05:00
*/
pub fn main() {}