mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
17 lines
244 B
Rust
17 lines
244 B
Rust
//@ run-pass
|
|
|
|
|
|
fn want_slice(v: &[isize]) -> isize {
|
|
let mut sum = 0;
|
|
for i in v { sum += *i; }
|
|
sum
|
|
}
|
|
|
|
fn has_mut_vec(v: Vec<isize> ) -> isize {
|
|
want_slice(&v)
|
|
}
|
|
|
|
pub fn main() {
|
|
assert_eq!(has_mut_vec(vec![1, 2, 3]), 6);
|
|
}
|