2 #![allow(stable_features)]
4 // Test to see that the element type of .cloned() can be inferred
5 // properly. Previously this would fail to deduce the type of `sum`.
7 #![feature(iter_arith)]
9 fn square_sum(v: &[i64]) -> i64 {
10 let sum: i64 = v.iter().cloned().sum();
15 assert_eq!(36, square_sum(&[1,2,3]));