summaryrefslogtreecommitdiffstats
path: root/src/test/ui/iterators/iter-count-overflow-debug.rs
blob: 8e59c11e9dccbfce04bbe8f6142e02467ea66b0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// run-pass
// only-32bit too impatient for 2⁶⁴ items
// needs-unwind
// compile-flags: -C debug_assertions=yes -C opt-level=3

use std::panic;

fn main() {
    assert_eq!((0..usize::MAX).by_ref().count(), usize::MAX);

    let r = panic::catch_unwind(|| {
        (0..=usize::MAX).by_ref().count()
    });
    assert!(r.is_err());
}