//@ run-pass //@ needs-unwind //@ compile-flags: -C overflow-checks use std::panic; fn main() { let r = panic::catch_unwind(|| { [1, i32::MAX].iter().sum::(); }); assert!(r.is_err()); let r = panic::catch_unwind(|| { [2, i32::MAX].iter().product::(); }); assert!(r.is_err()); let r = panic::catch_unwind(|| { [1, i32::MAX].iter().cloned().sum::(); }); assert!(r.is_err()); let r = panic::catch_unwind(|| { [2, i32::MAX].iter().cloned().product::(); }); assert!(r.is_err()); }