about summary refs log tree commit diff
path: root/src/test/ui/iterators/iter-count-overflow-debug.rs
blob: d6612035750836e49accc865a8f2d05dcaeb35b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-pass
// only-32bit too impatient for 2⁶⁴ items
// ignore-wasm32-bare compiled with panic=abort by default
// compile-flags: -C debug_assertions=yes -C opt-level=3

use std::panic;
use std::usize::MAX;

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

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