2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2016-09-10 03:39:49 +00:00
|
|
|
// compile-flags: -C debug_assertions=no
|
|
|
|
|
|
|
|
fn main() {
|
2020-06-02 07:59:11 +00:00
|
|
|
assert_eq!([1i32, i32::MAX].iter().sum::<i32>(),
|
|
|
|
1i32.wrapping_add(i32::MAX));
|
|
|
|
assert_eq!([2i32, i32::MAX].iter().product::<i32>(),
|
|
|
|
2i32.wrapping_mul(i32::MAX));
|
2016-09-10 03:39:49 +00:00
|
|
|
|
2020-06-02 07:59:11 +00:00
|
|
|
assert_eq!([1i32, i32::MAX].iter().cloned().sum::<i32>(),
|
|
|
|
1i32.wrapping_add(i32::MAX));
|
|
|
|
assert_eq!([2i32, i32::MAX].iter().cloned().product::<i32>(),
|
|
|
|
2i32.wrapping_mul(i32::MAX));
|
2016-09-10 03:39:49 +00:00
|
|
|
}
|