]>
Commit | Line | Data |
---|---|---|
b7449926 XL |
1 | // run-pass |
2 | #![allow(stable_features)] | |
3 | ||
c34b1796 AL |
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`. | |
223e47cc | 6 | |
62682a34 | 7 | #![feature(iter_arith)] |
223e47cc | 8 | |
c34b1796 | 9 | fn square_sum(v: &[i64]) -> i64 { |
9346a6ac | 10 | let sum: i64 = v.iter().cloned().sum(); |
c34b1796 AL |
11 | sum * sum |
12 | } | |
13 | ||
14 | fn main() { | |
15 | assert_eq!(36, square_sum(&[1,2,3])); | |
16 | } |