2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2016-09-09 20:39:49 -07: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-09 20:39:49 -07: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-09 20:39:49 -07:00
|
|
|
}
|