2018-09-04 12:05:53 +02:00
|
|
|
// run-pass
|
2014-03-05 15:28:08 -08:00
|
|
|
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn want_slice(v: &[isize]) -> isize {
|
2012-05-31 14:02:39 -07:00
|
|
|
let mut sum = 0;
|
2015-01-31 12:20:46 -05:00
|
|
|
for i in v { sum += *i; }
|
2013-06-24 18:34:20 -04:00
|
|
|
sum
|
2012-05-31 14:02:39 -07:00
|
|
|
}
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn has_mut_vec(v: Vec<isize> ) -> isize {
|
2015-02-01 21:53:25 -05:00
|
|
|
want_slice(&v)
|
2012-05-31 14:02:39 -07:00
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2016-10-29 22:54:04 +01:00
|
|
|
assert_eq!(has_mut_vec(vec![1, 2, 3]), 6);
|
2013-02-14 11:47:00 -08:00
|
|
|
}
|